aspose file tools*
The moose likes Servlets and the fly likes How to upload a file  to servlet?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to upload a file  to servlet??" Watch "How to upload a file  to servlet??" New topic
Author

How to upload a file to servlet??

kaoalex
Greenhorn

Joined: Jul 12, 2001
Posts: 3
Often there is a html file in client ,
and upload a file to servlet.
But I have a question,
if I have a big file that want to upload a servlet by HttpURLConnection or other ,how to code in client??
PS:they are both java source code in client/Server.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

It's easy. Write a servlet to catch the data coming from the client, then have the client open a URLConnection to that servlet and pass the data down the channel.
A bigger problem is going to be the "sandbox". Java has safeguards to prevent applets from clandestinely opening the client's data files and passing them to an evil-intentioned server.


Customer surveys are for companies who didn't pay proper attention to begin with.
kaoalex
Greenhorn

Joined: Jul 12, 2001
Posts: 3
Thanks for your answer~~~
I know that how to upload a file to servlet.
But if have a sample code,is better~~~~~
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
"kaoalex",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
Thanks.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to upload a file to servlet??