File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Sending the file contents from the PC to a remote web server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Sending the file contents from the PC to a remote web server" Watch "Sending the file contents from the PC to a remote web server" New topic
Author

Sending the file contents from the PC to a remote web server

Mahesh Trikannad
Ranch Hand

Joined: Dec 14, 2004
Posts: 66
Hi,

I have a j2EE Web Server on a UNIX machine. I want to write a Web Interface, where the user can select a file from the PC, and then send it onwards to the web container or maybe j2ee container .

Can it be done by just using JSP's or servlets only.

One way I think , is to write a Applet which reads the file, and then have the Applet use a URLConnection to send to the HTTP server.

Thanks

Mahesh


Mahesh Trikannad
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30138
    
150

Mahesh,
You don't need the applet. There is an HTML tag for uploading files:


Your servlet will then get the file contents as part of the form, which it can process. While this could be done in a JSP, it is best to keep the code out of the JSP and use a servlet.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

Search for information on "multipart request" for futher information.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
Don't get me started about those stupid light bulbs.
 
subject: Sending the file contents from the PC to a remote web server
 
Similar Threads
Please help how to use local classes
Writing to a file
can applet read form a file on host machine
SENDING FILES FROM CLIENT to SERVER
how can i send a file(urgent)