2012-02-21 153 views
1

我想使用apache commons ftp将文件上传到FTP。 我使用,我看到的几个网站代码,包括计算器上传文件到FTP

Android FTP Library

的问题是,在该行:

Buffin = new BufferedInputStream (new FileInputStream (file)); 

我不能把任何路径,在“文件” ,eclipse不验证任何值或路径 -

什么将不得不在“新的FileInputStream”中指出?

我不知道我做错了。

非常感谢和问候

+0

应该是什么样的对象?该字符串未验证 – 2012-02-22 00:01:56

回答

1

创建路径的File对象,并传递它。

2

你需要一个File对象将其传递给FileInputStream

Buffin = new BufferedInputStream(new FileInputStream(new File("/path/to/file")); 

而你不能Upload file to FTP因为FTP不是一个地方,它是一个协议。

1

你可以这样做:在这里 Buffin = new BufferedInputStream (new FileInputStream (<path to your file>));

详情: FileInputStream