This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Servlets and the fly likes Copy file from client to Webserver Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Copy file from client to Webserver" Watch "Copy file from client to Webserver" New topic
Author

Copy file from client to Webserver

Raj Puri
Ranch Hand

Joined: Apr 24, 2003
Posts: 189
I have binary files and I will like to copy them from Client to server using a URL? How can I do that in a servlet. Thanks.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Take a look at http://jakarta.apache.org/commons/fileupload


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Raj Puri
Ranch Hand

Joined: Apr 24, 2003
Posts: 189
In our case we want to save the files on a server different than web server. Like I will save them on the box where I have database, my webserver works on a different box. We are trying to save pictures here on file system and will create a documentlink to them thru Apache conf file on webserver using proxy. Any idea will uploadfile packages help me on this from Apache? Thanks.
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 471
Hmm. Indeed how? Maybe try BLOB? In more details, use applet which connected to your database using JDBC and save binary files using BLOB.


Get power of your iPod with MediaChest | Minimal J2EE container is here | Light weight full J2EE stack | My blog | Co-author of "Windows programming in Turbo Pascal"
Raj Puri
Ranch Hand

Joined: Apr 24, 2003
Posts: 189
That is what I do now(save in blob in db and then write out to file on db server). But it is a lot of overhead. My thinking was as my database box has a http server(tomcat), may be I can create a proxy to that
http server from my public domain server where the JSP(applcation) will be hosted and copy file to that from my PC. Now,this may a theortical idea that may not work. I wanted some views on this, is it as simple as above. Thanks.
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 471
Personally, I use a proxy servlet for such purpose. It works fine for my case and exactly case as you have, I do not want to store big files in blob, I store them separately.
Raj Puri
Ranch Hand

Joined: Apr 24, 2003
Posts: 189
I really do not know how to implement this. I was going to use fileupload utility come with common lib in tomcat. By reading the documentation seems
it likes to se a path like /tmp/xx etc that should be there on web server to upload file. Here I want to upload direct to file system on third tier(where DB is mounted) using servlet running on webserver. Will appreciate any help on this.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Copy file from client to Webserver
 
Similar Threads
copyrite protection
Packaging
using jsp to copg files from a directory
Accessing remote object
copy file from server to client