Tim Holloway wrote:Although you specifically mentioned that you're uploading files to a folder, I'll go ahead with the standard warning that you should never upload anything to be inside your WAR or appserver directories, just in case you thought that you could create upload folders in the WAR (Well, you often can, but sooner or later, you'll regret it).
And, of course, uploading actually gets staged from a general upload facility, so that the incoming data has to be serialized out to a file that you yourself create - you shouldn't expect that data to live indefinitely in the staging area.
Once the preceding annoying details have been attended to, the actual process of renaming a file is fairly easy. Just use the java.io.File renameTo() method.
Tim Holloway wrote:I believe one of them is in cases where you want to move the file to a different drive letter (for that, you have to do things the hard way, via copy-and-delete).
Tim Holloway wrote:
There a a number of reasons why renameTo() can fail. I believe one of them is in cases where you want to move the file to a different drive letter (for that, you have to do things the hard way, via copy-and-delete). So if you could provide some details on how your rename attempt is set up and what error response you get, it would be a big help.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koophttps://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton