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

uploading a file to server

zander alex
Greenhorn

Joined: Jun 29, 2013
Posts: 1
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
Bartender

Joined: Mar 28, 2008
Posts: 1173
    
  65

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


Tim Driven Development
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61657
    
  67

Also see the ServletsFaq for an entry on file uploading.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Anil Kumar Goud
Greenhorn

Joined: Jul 11, 2013
Posts: 12

Hey,

Find the link for your requirement. http://www.tutorialspoint.com/servlets/servlets-file-uploading.htm
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61657
    
  67

Be aware that emitting HTML from a servlet, as is shown in that example, is considered a bad practice.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: uploading a file to server