I am trying to pick a video, selecting and displaying the video works fine, but when I try to get the full path to the video file I get a wrong path.
In the following code fragment I am trying to obtain the full path to the file:
Uri uri = Uri.parse(url);
File file = new File((uri.getPath()));
And then when I set the multipart entity filebody I pass it the file.toString()
.
I am getting the following exception when trying to upload the file.
03-28 12:43:27.129: W/System.err(6018): java.io.FileNotFoundException: /content:/media/external/video/media/32398: open failed: ENOENT (No such file or directory)
03-28 12:43:27.157: W/System.err(6018): at libcore.io.IoBridge.open(IoBridge.java:416)
03-28 12:43:27.157: W/System.err(6018): at java.io.FileInputStream.<init>(FileInputStream.java:78)
03-28 12:43:27.157: W/System.err(6018): at org.apache.http.entity.mime.content.FileBody.writeTo(FileBody.java:92)
03-28 12:43:27.165: W/System.err(6018): at org.apache.http.entity.mime.HttpMultipart.doWriteTo(HttpMultipart.java:206)
03-28 12:43:27.165: W/System.err(6018): at org.apache.http.entity.mime.HttpMultipart.writeTo(HttpMultipart.java:224)
03-28 12:43:27.169: W/System.err(6018): at org.apache.http.entity.mime.MultipartEntity.writeTo(MultipartEntity.java:183)
03-28 12:43:27.169: W/System.err(6018): at org.apache.http.impl.entity.EntitySerializer.serialize(EntitySerializer.java:97)
03-28 12:43:27.169: W/System.err(6018): at org.apache.http.impl.AbstractHttpClientConnection.sendRequestEntity(AbstractHttpClientConnection.java:162)