2014-01-06 68 views

回答

2

對於上傳/下載IMG,TXT或DOC文件,只需使用文件API(文件傳輸)
更多細節使用這個鏈接http://docs.phonegap.com/en/edge/cordova_file_file.md.html#FileTransfer

var win = function (r){ 

    } 

    var fail = function (error) { 

    } 

    var options = new FileUploadOptions(); 
    options.fileKey = "file"; 
    options.fileName = fileURI.substr(fileURI.lastIndexOf('/') + 1); 
    options.mimeType = "text/plain"; 
    var params = {}; 
    params.value1 = "test"; 
    params.value2 = "param"; 
    options.params = params; 
    var ft = new FileTransfer(); 
    ft.upload(fileURI, encodeURI("http://some.server.com/upload.php"), win, fail, options);