File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes How to move a video file(*.flv) from a directory to another directory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "How to move a video file(*.flv) from a directory to another directory " Watch "How to move a video file(*.flv) from a directory to another directory " New topic
Author

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

Subrata Pradhan
Greenhorn

Joined: May 05, 2012
Posts: 8
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

Joined: Oct 27, 2005
Posts: 19693
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61206
    
  66

What is this doing in your code?
Subrata Pradhan wrote:
catch(Exception e){}


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19693
    
  20

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

Joined: May 05, 2012
Posts: 8
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 :)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to move a video file(*.flv) from a directory to another directory