Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.
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.
Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.
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).
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
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.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.
Yes it can be done, we just have to figure out how.
Is that a spider in your hair? Here, threaten it with this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|