• Post Reply Bookmark Topic Watch Topic
  • New Topic

File Upload Tool  RSS feed

 
Anupam Bhatt
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am creeating a File Upload page [JSP], where the user can clik on browse button and open the directory structure of his local system and select a file to upload to my server.

What direction should i need to move? i mean how is it possible [through any api or something?]to show the user his system's directory structure and then accept a file and upload it ?

Any help in this regard will be appreciated.
 
Manuel Moons
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use :


This will create a textfield with a browse button.
 
Anupam Bhatt
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for this.. well this i could achieve easily... actually i was asking about the background processing in Java..
 
Manuel Moons
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The upload is handled by your browser if you create a html client.

If you would like to write your own client in Java you can use the HttpClient library in the Apache Commons project.

HttpClient in Apache Jakarta Commons


If you write a Servlet using the Apache Commons FileUpload package you can write the server side.

Apache Commons FileUpload

I don't know if this fits you needs? I'm not sure what you are trying to do exactly!
 
Anupam Bhatt
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Manuel Moons:
The upload is handled by your browser if you create a html client.

If you would like to write your own client in Java you can use the HttpClient library in the Apache Commons project.

HttpClient in Apache Jakarta Commons

If you write a Servlet using the Apache Commons FileUpload package you can write the server side.

Apache Commons FileUpload

I don't know if this fits you needs? I'm not sure what you are trying to do exactly!


Well i am trying a file upload in a jsp. Similar to the fileupload link you gave.. "Apache Commons FileUpload".. i am using oreilly jason's multipart code..

but am getting these errors "*ERROR* webapp-Author: error reading or saving file java.io.IOException: Corrupt form data: premature ending"

Wanted to know what could be wrong here !
 
Manuel Moons
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't really say what your problem could be. I have never used the libraries provided by 0'Reilly and I am pretty sure that I never will use them. Those libraries have been written for educational purposes, I'm not sure if they are robust enough to run in a "real" environment.

The only thing I can say is that the Apache libraries are of good quality. I have used them and never experienced any problems.

Maybe you can show me the code that you are using? I think there might be something wrong with the client upload side!
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Manuel Moons:
Those libraries have been written for educational purposes.


Hardly.

The classes in the com.oreilly.servlet package have been offered from this site since April 1998. The MultipartRequest class has become the de facto standard for handling file uploads. The classes have been widely tested on a multitude of platforms and server configurations, and you should find this a very stable release.

com.oreilly.servlet readme

Anupam, you could probably get some useful information from the com.oreilly.servlet FAQ, which contains such interesting topics as this one:
Why when using com.oreilly.servlet.MultipartRequest or MultipartParser am I getting an IOException saying "Corrupt form data: premature ending" or "Separation boundary was not specified" or "unexpected end of part"?
 
Anupam Bhatt
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Joe Ess:
Anupam, you could probably get some useful information from the com.oreilly.servlet FAQ, which contains such interesting topics as this one:

quote:Why when using com.oreilly.servlet.MultipartRequest or MultipartParser am I getting an IOException saying "Corrupt form data: premature ending" or "Separation boundary was not specified" or "unexpected end of part"?


That was quite informative Thanks
[ June 20, 2005: Message edited by: Anupam Bhatt ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!