0

Im using this library for the ftp upload:

http://androidexample.com/FTP_File_Upload_From_Sdcard_to_server/index.php?view=article_discription&aid=98

This my code but it isnt working:

 FTPClient client = new FTPClient();

                        try {

                            client.connect("xx.xx.xx.xx", 21);
                            client.login("xxx", "xx");
                            client.setType(FTPClient.TYPE_BINARY);
                            client.changeDirectory("/picts_products/");

                            File f = new File("/logo.png");

                            client.upload(f);

I alway get this error: java.io.FileNotFoundException. Do you know why?

UPDATE!

Since API 23 the permissions must be checked by the activity! This solved my problem:

Exception 'open failed: EACCES (Permission denied)' on Android

Community
  • 1
  • 1
Ero Stefano
  • 556
  • 2
  • 9
  • 27
  • 2
    Yes, I know why! The file wasn't found at that path, just like the error says. Perhaps try "./logo.png", if the file is in your project base directory? – Tennyson H Feb 19 '16 at 17:14
  • This doesnt work too. Actually I create a file and put that in the upload. In the example from http://androidexample.com/FTP_File_Upload_From_Sdcard_to_server/index.php?view=article_discription&aid=98 they do the same. Do you know any other way? – Ero Stefano Feb 19 '16 at 22:02
  • I also tryed with Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES – Ero Stefano Feb 19 '16 at 22:16

0 Answers0