簡體   English   中英

無法從Android中的ftp服務器下載txt文件

[英]Unable to download txt file from ftp server in Android

我正在嘗試從android應用中的ftp服務器下載,但是當我創建本地文件時,我無法寫入。

這里的代碼:

        String servidor = ips[0];
        int reply;
        ftp.setDataTimeout(1000);
        ftp.connect(servidor);
        ftp.login(usuaris[0], pass[0]); // ftp.login( username password)
        //ftp.changeWorkingDirectory(".");
        ftp.setFileType(FTP.ASCII_FILE_TYPE);
        File file = new File("resultat.txt");
        FileOutputStream fos = new FileOutputStream(file); 
        ftp.retrieveFile("ARTI.txt", fos);
        fos.close();

當我這樣做時

FileOutputStream fos = new FileOutputStream(file);

我有這個例外:

java.io.FileNotFoundException:resultat.txt:打開失敗:EROFS(只讀文件系統)

聽起來您在服務器級別的目錄或文件位置不正確。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM