cordova - form file upload phonegap -
please upload basic working version of file upload script written in javascript phonegap friendly
i've trawled internet trying figure out of stuff out there either out of date or newer stuff seems presume know inner workings of phonegap
i grasp how transfer file cannot figure out how explore/access phones/tablets file system desired file upload
in perfect world phonegap recognise form file upload button , convert works same if in web browser seems disable it.
i'm using php sever side. i've spend days trying understand how it... massively appreciated!
try following. file first , pass file path , type parameters.
function gotfile(file) { uploadfile(file.fullpath,file.type); } function uploadfile(imageuri,type) { var options = new fileuploadoptions(); options.filekey = "file"; options.filename = imageuri; options.mimetype = type; var params = {}; //params.filepath = "files/"; options.params = params; var ft = new filetransfer(); ft.upload(imageuri, "http:/www.xx.com/fileupload.php",function onfiletransfersuccess(e){ alert("file success"); }, fail, options); }
your php server side function like(fileupload.php):
<?php $new_image_name = "file.pdf"; $type = $_files["file"]["type"]; $name = $_files["file"]["name"]; //$paramvalue = $_post['value1']; move_uploaded_file($_files["file"]["tmp_name"], "your storage location".$new_image_name); ?>
let me know difficulties.
Comments
Post a Comment