我试图做一个非常简单的文件上传。我想要一个可以上传我告诉它的任何文件的Java FTPClient。但PDF总是搞砸了,我的PDF编辑器(Adobe)不会打开它,说有一个I/O错误。FTPClient - 爪哇,上传文件
我使用了下面的类:
import org.apache.commons.net.ftp.FTPClient;
....
FTPClient client = new FTPClient();
FileInputStream fis = null;
try {
client.connect("mydomain.com");
client.login("user", "password");
String filename = "myPDF.pdf";
fis = new FileInputStream(filename);
client.storeFile("temp.pdf", fis);
fis.close();
client.logout();
} catch (IOException e) {
e.printStackTrace();
}
为什么不这项工作,如何解决呢?
你从半小时前尝试在你的问题的答案? http://stackoverflow.com/questions/5925438/url-connection-ftp-in-java-simple-question – Aleadam 2011-05-08 04:47:41
是的,我现在使用FTPClient。这个问题完全不同。 – CodeGuy 2011-05-08 04:51:50