Wednesday, May 10, 2017

java - FileInputStream error when reading from uri

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 :



 

.....
.....



What may be the problem ?



Any help appreciated.

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...