Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

File Upload  RSS feed

 
ford Darcy Jr
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using multipartrequest for fileupload in servlets. I want to save the file with the new filename on the server. But its getting saved with the original filename. Is there anyway to save the file with a new filename ?

Thanks.
 
Akbar Basha R
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Upload the file with the original file name and then use the File Class and the renameTo method to change the file name to a new one.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!