| Author |
How to move a video file(*.flv) from a directory to another directory
|
Subrata Pradhan
Greenhorn
Joined: May 05, 2012
Posts: 6
|
|
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: 19216
|
|
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
How To Ask Questions How To Answer Questions
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56220
|
|
What is this doing in your code?
Subrata Pradhan wrote:
catch(Exception e){}
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
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: 6
|
|
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 :)
|
 |
 |
|
|
subject: How to move a video file(*.flv) from a directory to another directory
|
|
|