Pushpendra Kuntal
Pushpendra Kuntal

Reputation: 6186

How can access a image file stored in my sd card

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 in 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.

Upvotes: 1

Views: 965

Answers (2)

Pushpendra Kuntal
Pushpendra Kuntal

Reputation: 6186

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); 

Upvotes: 0

CrackerJack9
CrackerJack9

Reputation: 3651

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.

Upvotes: 1

Related Questions