Q:

form file upload phonegap

Please could someone upload a very basic but working version of a file upload script written in javascript that will then be phonegap friendly
I've trawled the internet trying to figure it out but most of the stuff out there is either out of date or the newer stuff seems to presume that you know all about the inner workings of phonegap
I grasp how to transfer the file but I cannot figure out how to explore/access the phones/tablets file system to look for the desired file for upload
In a perfect world phonegap would recognise the form file upload button and convert it so it works the same as if it were in a web browser but all it seems to do is disable it.
I'm using php as the sever side. I've spend days trying to understand how to do it... any help would be massively appreciated!

A:

Try like following. Get the file first and pass the file path and type as 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 is 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 any difficulties.

