2014-01-06 36 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);