wood burning stoves 2.0*
The moose likes Servlets and the fly likes Copy file from client to Webserver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
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: 472

Hmm. Indeed how? Maybe try BLOB? In more details, use applet which connected to your database using JDBC and save binary files using BLOB.


Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | 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: 472

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Copy file from client to Webserver
 
Similar Threads
Packaging
copy file from server to client
Accessing remote object
copyrite protection
using jsp to copg files from a directory