I have uri of file on android phone : content://com.android.contacts/contacts/472/photo
. I got it from PhoneGap Contacts plugin. It is actually contact image. Now I need to upload that image on server but when I upload it and try to see it it is not visible. I managed to google a little bit and found that for file upload I need to have full file://
path. Now my question is how to convert content://
to file://
or how to upload files with content://
uri on server?
I have tried using window.resolveLocalFileSystemURI(uri, win, fail);
and than
function win(fe){
alert("win");
alert(fe.fullPath);
}
function fail(a){
alert('fail');
}
But somehow it just "skipp" window.resolveLocalFileSystemURI(uri, win, fail);
. It is never executed... No error in LogCat and no any alert from these 3 ... Can this be solution of my problem and why no response is returned?
I don't have direct experience with the contacts plugin, but the docs make me think that you are not looking at a filesystem URI, rather an entry in the contacts database. [http://docs.phonegap.com/en/3.3.0/cordova_contacts_contacts.md.html#contacts.find]
So, you are likely mis-interpreting the concept of a URI, especially in the context of the filesystem. [http://en.wikipedia.org/wiki/Uniform_resource_identifier] and [http://www.html5rocks.com/en/tutorials/file/filesystem/].
From the plugin docs, we do see that 'photos' is a property of each contact.
how to upload files with content:// uri on server?
for the desired contact, you could create a file using the photos property, and then upload using the phonegap file-transfer plugin. [http://docs.phonegap.com/en/3.3.0/cordova_file_file.md.html#FileTransfer]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.