This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Servlets and the fly likes File upload on different server Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "File upload on different server" Watch "File upload on different server" New topic
Author

File upload on different server

Anuj Jais
Greenhorn

Joined: May 08, 2007
Posts: 4
hi,

I am using struts common file upload to upload file from client. My problem is my application is running on server A but i want to store uploaded stream on server B without storing it on server A(i,e. without using FTP or rsync from server A to server B). Please help how can i achieve this task.

Anuj
[ May 08, 2007: Message edited by: Bear Bibeault ]
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2300
In the action class you get a FormFile which contains the data of the uploaded file , make a file in the server B with the content of FormFile.I mean in a shared directory in system B.

Never tried this,

File f = new File("\\machine\sharedDir");
Flush the content of the uploaded file in f.


Rahul Bhattacharjee
LinkedIn - Blog
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Anuj Jais,

In an effort to help you get the most from our forums, we've compiled a
list of tips for asking questions here. You can find the list in our
FAQ section here.
In particular please see:
EaseUp
to find out how using "urgent" in your posts or subject line can actually slow down or stop responses to your question altogether.

Again, welcome to JavaRanch and good luck with your question.
-Ben


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56544
    
  14

As a favor, I have removed URGENT from the subject. Please read Ben's post carefully.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Anuj Jais
Greenhorn

Joined: May 08, 2007
Posts: 4
it was my first experience. Will keep in mind about URGENT in future...

Mapping drive is not a good solution on linux boxes that slows down the traffic.

Is there anything else which can be done?
Preeti Arora
Ranch Hand

Joined: Jan 26, 2007
Posts: 74
You can use UNC to solve this problem.You dont have to map drive for that.Also I am not sure whether this works in linux.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16487
    
    2

You want to transfer data from machine A to machine B and store it there (in a file, I assume). And you don't want to do FTP, you don't want to map a drive to machine B. So: what kind of server do you have running on machine B that can accept file transfers?

Actually now that I read your post again, you say you don't want to use FTP because you don't want the data stored on machine A. So it appears that you are assuming you must store the data somewhere on machine A in order to use FTP to get it to machine B. This is not the case.
Anuj Jais
Greenhorn

Joined: May 08, 2007
Posts: 4
Hi Paul,

this is what i want to do:

1). i have web application running on server A. User select file to be uploaded.
2) The file stream comes to action sitting on server A
3) I want to store this file on fileserver B without storing it on server A thats why i dont want to user FTP or rsync.
4) Both server A and fileserver B are linux boxes.

I hope i am clear now as to what i am trying to do. Sorry about the confusion.

Please help
Anuj
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: File upload on different server
 
Similar Threads
execute ftp commands using java API
Regarding FTP froma remote server
Multiple file upload using java applet
File upload on different server. URGENT need help.
How to unzip a file on a remote unix server using java