2012-02-21 94 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