I am working on phonegap with an Android project. I want to upload a file that is stored in my sd card to a server.
I want to be able to get a file that is stored i开发者_如何学Gon my assets folder.
**FileTransfer.upload(imageURI, "http://http://192.168.1.214/MusicApplication/welcome.php", win, fail, options);**
then please suggest me what should imageURI in above function if my image is stored in assets folder.
Take a look at this for Using External Storage.
Depending upon your API level, use getExternalFilesDir()
or getExternalStorageDirectory()
to find the file you are looking for.
his is the solution of my problem:-
var options = new FileUploadOptions();
options.fileKey="file";
options.fileName=document.getElementById('txtFileName').value; options.mimeType="audio/mpeg"; var params = new Object();
params.value1 = "test";
params.value2 = "param";
options.params = params;
var ft = new FileTransfer();
ft.upload(fileName, "192.168.1.214/MusicApplication/upload.php";, win, fail, options);
精彩评论