• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

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

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:
 
Sheriff
Posts: 22850
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is this doing in your code?

Subrata Pradhan wrote:
catch(Exception e){}


 
Rob Spoor
Sheriff
Posts: 22850
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 :)
 
reply
    Bookmark Topic Watch Topic
  • New Topic