• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Upload file from browser

 
jack nick
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
I have to upload files from a browser (local system) to a location on the web server. Am using JSP to do this. Am totally clueless on how to go about doing. Some tips would help a lot.
Thanks
Jack
 
hemanth kumar
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jack
There are several options that u can follow
Code the Uploading part urself or take a ready made components
Some of the readymade ones that i know are
jspsmartupload.
If u want to code it urself then here are some steps to follow
U should use the <FILE> tag for choosing the file on ur page.
Also the form tag should have ENCTYPE as multipart/form-data
Heres a sample
'<form id="frmUpload" name="frmUpload" METHOD="post" ENCTYPE="multipart/form-data">'
Now when u click on the upload button in ur page,the file that is to be uploaded goes as Header data to the submitted page.
In the submitted page code has to be written to read the header data and pluck out the File data from there and recreate the uploaded file in the server.
There is a very nice explanation on how the Uploading process actually works given in 15seconds.com. Read that for a much clearer understanding.
Hope this helps
Regards
Hemanth
 
jack nick
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Hemanth,
Will check this out
 
Andrew Shafer
Ranch Hand
Posts: 338
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

A package that can be used to upload files and so much more:
com.oreilly.servlet

available from servlets.com
Free for use in non-comercial projects and free for use in commercial projects if you buy the guy's book.
(read the license)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic