0

I need to post Audio file(picking from Audio/* intent) to server.here i got Uri, but the posting param type is File. I Used below code but it shows /directory/.. is not a absolute path and getting FileNotFoundException. Any one suggest me..

Code :

Uri uri=data.getData();

File f=new File(uri.getPath());

Log:

09-26 21:20:19.735: I/System.out(920): java.io.FileNotFoundException: /document/audio:5257: open failed: ENOENT (No such file or directory)

1 Answers1

0

(this is a duplicate)

See here: Convert file: Uri to File in Android

Don't use Uri::ToString() and use Uri::getPath() instead.

Community
  • 1
  • 1
kha
  • 19,123
  • 9
  • 34
  • 67