• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File upload problem in struts 2 (emoving file attachment)

 
Manish Shinde
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

I have developed file upload application in struts 2.
Here File Upload Interceptor actually deletes the the uploaded file , once the
action is executed.
so before returning success I have called function to copy.
Here is my action class



questions
1)Is there any way to tell the interceptor not to delete that file ?
2)In line 56 of code ,I have specified destination path and file name with extension.
what if I want to upload .doc file then I'll have to change extension again ?


Regards,
Manish,

 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The FileUpload interceptor is responsible for uploading the file once the upload is once it will remove the file immediately due to security reasons so we have to handle the file. Just save the file where you want to save it.
FileUtils.copyFile(attachment, fileDestination);
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic