0

I have this bit of code :

protected String doInBackground(String... params) {

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        FileInputStream fis;
        try {
            File F = new File(FilePath);
            fis = new FileInputStream(F);
            du.Upload(fis,Fname);             
        } catch (Exception e) {
            e.printStackTrace();
        }
      }

fis is generating the following error :

`java.io.FileNotFoundException: /storage/emulated/0/When We Are Young(AnyMaza.Com).mp3: open failed: EACCES (Permission denied)`

FilePath is like this :

/storage/emulated/0/When We Are Young(AnyMaza.Com).mp3

And I have added in my application manifest the read and write permissions :

 <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
.....
  <application
.....

What may be the problem ?

Any help appreciated.

Sora
  • 2,697
  • 15
  • 62
  • 127
  • Is the device api> 23? – sumandas Aug 20 '16 at 06:47
  • I think the prob in file name. remove space from your file name like /storage/emulated/0/WhenWeAreYoung(AnyMaza.Com).mp3 other wise select file name which not contain any space inside name. – Mayur Patel Aug 20 '16 at 06:50
  • yes the device is api>23, lol i fixed the issue based on this link : `http://stackoverflow.com/questions/8854359/exception-open-failed-eacces-permission-denied-on-android` the second answer. – Sora Aug 20 '16 at 06:54

0 Answers0