aspose file tools*
The moose likes Servlets and the fly likes how to upload a file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "how to upload a file" Watch "how to upload a file" New topic
Author

how to upload a file

rajareddy annavaarm
Ranch Hand

Joined: Mar 15, 2007
Posts: 96
I need code how to upload a file to server with explanation.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39578
    
  27
There are lots of ways to do that, depending on your circumstances. For starters, have a look at the FileUpload FAQ page.


Ping & DNS - updated with new look and Ping home screen widget
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Posting again.

One very simple way I came to know recently is through File I/O operations. Yes, this works even if the file is at client machine, just read the file using simple File I/O operation like you do in a desktop application.

Let me know if you face any problem.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by ankur rathi:
Posting again.

Yes, this works even if the file is at client machine, just read the file using simple File I/O operation like you do in a desktop application.


This most certainly will not work.
How can Java on a server access files on a client machine?
It can't.

rajareddy,
Follow the link in Ulf's post for tips on file uploading.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Originally posted by Ben Souther:


This most certainly will not work.
How can Java on a server access files on a client machine?
It can't.

rajareddy,
Follow the link in Ulf's post for tips on file uploading.


I tested that code and you know what, server and client both were on same machine and it worked.

Hmmm, let me check again. :roll:
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Originally posted by ankur rathi:


I tested that code and you know what, server and client both were on same machine and it worked.

Hmmm, let me check again. :roll:


Very stupid.
Now I am laughing on myself.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to upload a file
 
Similar Threads
How can I upload a File using Struts
How to upload a file using a servlet?
uploadling file in jsp
File upload
doPut()????