Hi I'm trying to return a value from a API call via the file transfer plugin for cordova. I've shown below my php code for the API which is working fine and the Cordova code. Essentially what I want to do is turn the return statement in the API into a JS variable in Cordova. This is the Php code, the move_uploaded_file part works fine:
protected function uploadPicturesAction()
{
move_uploaded_file($tmp_name, "/home/sean/images/{$name}.jpg");
return $name;
}
This is the cordova part, so here I am trying to get the variable $name to become a JS variable.
fileTransfer.upload(image, encodeURI("sean.co.uk/api.php?action=uploadPictures"), imagePage2(), fail, options);
Any help would be much appreciated.
loadpics.php
) that contains the function uploadPicturesAction
either through including a library file or just hard coded.echo uploadPicturesAction();
loadpics.php
and assign the return value to your javascrpt variable.
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.