• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

File Upload Tool

 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
No matter how many women are assigned to the project, a pregnancy takes nine months. Much longer than this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic