Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to upload a file

 
rajareddy annavaarm
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need code how to upload a file to server with explanation.
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are lots of ways to do that, depending on your circumstances. For starters, have a look at the FileUpload FAQ page.
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic