• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

uploading a file to server

 
zander alex
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

I am designng a web page using extks and servlets.
The servlet shoud access the clients machine local files and upload to the server.

for example i have a file date.txt in clients local system (C:/users/Documents/date.txt) and it should get upladed into server (/temp/hyd/date.txt).
Any possiblity of doing this other than multipart/form-data.

please help
thanks
 
Tim Cooke
Sheriff
Pie
Posts: 3151
136
Clojure IntelliJ IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Imagine the security implications of a browser that allowed a website to go hoking around in the client machine's file system lifting whatever files it wanted? Hence, this is not possible.

There's a pretty good example of how to implement file upload using a web form here: http://www.coderanch.com/t/609232/Servlets/java/find-uploaded-file-upload
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also see the ServletsFaq for an entry on file uploading.
 
Anil Kumar Goud
Greenhorn
Posts: 12
Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

Find the link for your requirement. http://www.tutorialspoint.com/servlets/servlets-file-uploading.htm
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Be aware that emitting HTML from a servlet, as is shown in that example, is considered a bad practice.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic