aspose 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 Soft Skills this week in the Jobs Discussion 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: 68
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
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31057
    
232

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: 61761
    
  67

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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sending the file contents from the PC to a remote web server