• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 277
  • Last Modified:

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

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
Jaziar
Asked:
Jaziar
  • 6
  • 4
1 Solution
 
CEHJCommented:
If you have a network share you can write it directly, otherwise yes
0
 
JaziarAuthor Commented:
How would you handle it if you had a network share?  Can you show an example?
0
 
CEHJCommented:
Try

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

then copy the stream
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
JaziarAuthor Commented:
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
 
JaziarAuthor Commented:
Points increased
0
 
CEHJCommented:
>>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
 
JaziarAuthor Commented:
I was told that FTP is the only way.
0
 
CEHJCommented:
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
 
contactkarthiCommented:
this tutorial here lets you to upload or download thru FTP

http://www.javaworld.com/javaworld/jw-04-2003/jw-0404-ftp.html
0
 
CEHJCommented:
Otherwise use an FTP API such as Commons Net
0
 
CEHJCommented:
:-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now