This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Copying a file using http

 
Adi Kulkarni
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I need to copy a file (around 500 MB zip file) from a location a(client) to location b(server).The two machines are separated by firewall hence the conventional copy is not possible.

Port 8080 for the server is open. Is it possible for me to copy a file from that client location to a server location using http ? If yes can somebody provide me steps for doing so ?

Thanks,
Aditya
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This can easily be done with the help of the Apache Commons FileUpload library (on the client) and the Apache HttpClient library (on the server). See http://faq.javaranch.com/java/FileUpload for more information.
 
samir singha
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had written a file upload application using jsp and servlets using apache.commons.fileupload package. The application uses port 8080 to upload files to server (in a particular folder). I checked the application with 790 MB rar file uploading. It's working. Try to wrtie a servlet that upload the files using apache.commons.fileupload package (can be downloaded from apache's site). even if the firewall is on the application can upload file through port 8080 of Tomcat server. Hope you will be able to write the code to upload the file, else you can ask for the application code to me.
 
Adi Kulkarni
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a a lot Ulf!

Hey samir,

Can you share the code with me since I need to try it out soon. I shall modify according to my needs.

Thanks,
Aditya
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Adi Kulkarni wrote:Can you share the code with me since I need to try it out soon.

JavaRanch is NotACodeMill. We like for people to try to arrive at their own solution, since they will learn a lot more that way. This one in particular is not hard (the FileUpload documentation is pretty extensive). Let us know how it goes.
 
Adi Kulkarni
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ulf,

I'd better try it on my own

~Aditya
 
samir singha
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[ UD: We appreciate your effort at helping others, but please read my previous post on why I have removed the contents of this post. ]

please download common-fileupload-1.2.1.jar and common-io-1.4.jar from apache website. include these jar files in your classpath. import all other java packages as required.

Hope this code will work for you. Request acknowledgement.
 
samir singha
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sorry ulf. It seems I violeted the ethics of Javaranch forum. Next time I will be careful.
 
Ankit Garg
Sheriff
Posts: 9580
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
samir singha wrote:I am sorry ulf. It seems I violeted the ethics of Javaranch forum. Next time I will be careful.


You better do that, otherwise we have a special code of conduct for rule violators
 
Led Estonilo
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry off topic...


i loled lol
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic