Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to move a video file(*.flv) from a directory to another directory

 
Subrata Pradhan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am facing a problem for few days to move a video file from a client machine directory to a specific directory in server . I am using multipart/form-data for choosing multiple video files(*.flv) and commons-fileupload.jar and commons-io.jar for uploading purpose.

My Jsp File:


JAVA CODE:
 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

OK, so you already are able to get an InputStream for the uploaded file. What you now need to do is create a FileOutputStream, and copy all contents from the InputStream to that FileOutputStream. Make sure to close both streams when you're done with it, in a finally block.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64708
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is this doing in your code?
Subrata Pradhan wrote:
catch(Exception e){}

 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear is right. You should never ever catch exceptions and ignore them. If they occur you won't be informed in any way. The very least you should do is log it, by calling e.printStackTrace().
 
Subrata Pradhan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor :
OK, so you already are able to get an InputStream for the uploaded file. What you now need to do is create a FileOutputStream, and copy all contents from the InputStream to that FileOutputStream. Make sure to close both streams when you're done with it, in a finally block.


Thanks Rob...thanks for the help :)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic