• Post Reply Bookmark Topic Watch Topic
  • New Topic

File Uploading  RSS feed

 
Daslan Govender
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All





I require your assistance in the above matter.





I am trying to upload a file.



My Simple form is:



<form

action="/FileUpload/servlet/FileHandlerServlet"

enctype="multipart/form-data" method="post">

<p>

Type some text (if you like):<br>

<input type="text" name="textline" size="30">

</p>

<p>

Please specify a file, or a set of files:<br>

<input type="file" name="datafile" size="40">

</p>

<p>

<input type="submit" value="Send">

</p>

</form>





Please note the code in red. I pass this to a servlet.

The problems I experienced:

I can no longer access my normal parameter (i.e. textline) � This is due to enctype attribute. How do I access them now?
How do I filter for pdf �s? I tried using the accept attribute on IE and this does not work. Any Ideas?
How do I upload the file. I tried using the code attached. Where does FileOutputStream fileOut = new FileOutputStream(saveFile); save the file to. How can specify a location.


I am considering using ftp to upload the file. How do I get the attachment into an object like java.io.File ?




Your assistance will be highly appreciated.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your best bet is Jakarta Commons Fileupload
Here is the user guide
 
Daslan Govender
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. I found a nice api to use: javazoom.upload.UploadBean. Details can be found at: http://www.javazoom.net/jzservlets/uploadbean/documentation/index.html
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Daslan Govender:
Thanks. I found a nice api to use: javazoom.upload.UploadBean. Details can be found at: http://www.javazoom.net/jzservlets/uploadbean/documentation/index.html


Thanks for sharing, Daslan.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!