Jomar Sevillejo
Jomar Sevillejo

Reputation: 1698

PhoneGap Take picture and set FILE_URI as value of input

I have a phoneGap app that takes a picture and sets the value of a file input to the FILE_URI taken from the onCameraSuccess of getPicture.

When I alert the value of the file input, I get file:// .. . That means setting the value of the input file was successful.

but when PHP on a server recieves the form, the file input is empty. I tried echoing $_FILES["Customer_image"]["name"] but it's empty.

Did I miss something? is that allowed?

Upvotes: 1

Views: 430

Answers (1)

Anthony Chu
Anthony Chu

Reputation: 37520

You can't set the location of a file input and upload a file that way. On PhoneGap, you can use the upload() method of the FileTransfer object to upload a file based on the URI. See the docs here...

http://docs.phonegap.com/en/3.3.0/cordova_file_file.md.html#FileTransfer

Upvotes: 1

Related Questions