Hello Java Guru,
I wanted make a simple java application that would upload files using sun.net.ftp 
package that came with jdk1.02.
Following code i got from Java Newsgroup.

While compiling  the code i got "No method found matching write()" error in line 21
-------------------------------------------------------------------------------------
Line 21: tos.write(); // calling write() in TelnetOutputStream class.
-------------------------------------------------------------------------------------

Any help would be greatly appreciated.

**************************************************
upload files using sun.net.ftp package
***************************************************
package mednetrix;
import sun.net.ftp.*;
import sun.net.*;
import java.io.*;
import java.lang.reflect.*;

public class MedFtp extends FtpClient {

  public static void putFile() {
    try { FtpClient ftp = new FtpClient("minerva.mednetrix.com");
    ftp.login("your_user_id", "your_password");
    File file_in= new File("d:\\test.txt");
    FileInputStream is= new FileInputStream(file_in);
    byte[] bytes = new byte[1024];
    int c;
    int total_bytes=0;

    while((c=is.read(bytes)) !=-1) { total_bytes +=c; is.read(bytes,0,c); }

    TelnetOutputStream tos = ftp.put("test.txt");
    tos.write(); // ==> GOT ERORR While compliling: no method found matching write()
    tos.close();
  }
  catch (java.io.IOException e){ System.out.println(e);
  }
  }

public static void main(String args[]){
  putFile();
  }
}
*************************************************


Thanks,

Reza U Nabi
Medntrix.com, Inc.
Eamil: [EMAIL PROTECTED]

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to