Solved

Moving a file from the client to a server - FTP?

Posted on 2007-11-28
11
244 Views
Last Modified: 2010-03-30
I have a java app that produces a zip file.  After the zip file is created it needs to move the zip file from the client machine to a server.  What is the best way to move the zip file.  Is FTP the best way?
0
Comment
Question by:Jaziar
  • 6
  • 4
11 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 20366058
If you have a network share you can write it directly, otherwise yes
0
 

Author Comment

by:Jaziar
ID: 20366085
How would you handle it if you had a network share?  Can you show an example?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20366145
Try

new FileOutputStream("//machine_name/share_name/file");

then copy the stream
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:Jaziar
ID: 20366197
Just found out it is a solaris box, so I am guessing it will have to be FTP.  Do you have any examples of ftp code for me.  I will increase the points for you're time


0
 

Author Comment

by:Jaziar
ID: 20366199
Points increased
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20366264
>>Just found out it is a solaris box,

That doesn't make any difference if you have a mounted share:

new FileOutputStream("machine_name:/share_name/file");
0
 

Author Comment

by:Jaziar
ID: 20366304
I was told that FTP is the only way.
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 250 total points
ID: 20366327
No share, then


URLConnection conn = new URLConnection("ftp://username:password@solarisbox/x/y/filename");
conn.setDoOutput(true);
OutputStream out = conn.getOutputStream();
// Now write to it - path will have to exist

Open in new window

0
 
LVL 17

Expert Comment

by:contactkarthi
ID: 20366535
this tutorial here lets you to upload or download thru FTP

http://www.javaworld.com/javaworld/jw-04-2003/jw-0404-ftp.html
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20366751
Otherwise use an FTP API such as Commons Net
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20367762
:-)
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Java Timer (static) 9 43
replace a word with other 1 44
CSV file parsing thru Java 13 31
Is Applet the way to go for my drag and drop system? 8 14
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question