File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to upload a file to servlet??

 
kaoalex
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 17616
38
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
kaoalex
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6920
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic