• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Copying a file using http

 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am sorry ulf. It seems I violeted the ethics of Javaranch forum. Next time I will be careful.
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry off topic...


i loled lol
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic