commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "bort" <spamb...@rogers.com>
Subject [NET] FTP upload works from test environment but not production
Date Thu, 20 May 2004 00:34:06 GMT
Hi all

I've successfully implemented the Commons-Net package on my local Tomcat
server.  I am able to make a connection to a remote FTP server, and write an
OutputStream to it.  The code is as follows:

=======

  FTPClient ftp = new FTPClient();
  OutputStreamWriter osw = null;

  try {

   ftp.connect(server);

   if (username != null && username.length() > 0) {
    ftp.login(username, password);
   }

            ftp.setFileType(FTP.BINARY_FILE_TYPE);
            ftp.enterLocalPassiveMode();

   osw = new OutputStreamWriter(ftp.storeFileStream(filename));
   osw.write(filecontents);

            osw.close();

   ftp.disconnect();

  } catch (Exception e) {
   e.printStackTrace();
  }

=======

Problem is that when I transfer this code to a standalone Tomcat server
elsewhere, I get some peculiar behaviour.  The file gets created on the FTP
Server, but it has a size of 0 bytes.  It seems as if the OutputStreamWriter
is not sending the information out, to be written to the file.

Anyone have any ideas as to why this is happening?  If you need more
information, please let me know.

bort




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message