dcsimg
sending a file or file contents to a ftp server using java sockets
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Chico_Charlesworth
Posted On:   Friday, June 15, 2001 08:28 AM

I want to save a file on a FTP server ... if i wanted to use HTTP i would do something like this: PrintWriter out = new PrintWriter(socket.getOutputStream()); String encodedResponse = "response=" + URLEncoder.encode(response); out.println("POST " + address + " HTTP/1.0"); out.println("Content-Type:application/x-www-form-urlencoded"); out.println("Content-Length: " + encodedResponse.length()); out.println(); out.println(encodedResponse); out.println(); out.flush(); out.close(); socket.close   More>>

I want to save a file on a FTP server ... if i wanted to use HTTP i would do something like this:


PrintWriter out = new PrintWriter(socket.getOutputStream());


String encodedResponse = "response=" + URLEncoder.encode(response);


out.println("POST " + address + " HTTP/1.0");


out.println("Content-Type:application/x-www-form-urlencoded");


out.println("Content-Length: " + encodedResponse.length());


out.println();


out.println(encodedResponse);


out.println();


out.flush();


out.close();


socket.close();


Any ideas?
cheers,
chico.

   <<Less

Re: sending a file or file contents to a ftp server using java sockets

Posted By:   Tim_Rohaly  
Posted On:   Friday, June 15, 2001 09:23 AM

If you want to transfer a file to a server using FTP,
the first thing you should do is read the FAQs, where
this is discussed several times. If you really want to
use sockets directly, then you should read the FTP
specification to see the details of the FTP protocol.
A link to that specification is also in the FAQs.
About | Sitemap | Contact