我上传000000001.db文件到服务器通过使用文件传输API的phonegap,但它给了我错误 文件未找到错误代码= 1 任何人都可以帮助我如何摆脱这件事。如何使用phonegap的文件传输API将000000001.db文件上传到服务器?
function uploadFile() {
alert('uploading file');
// Get URI of picture to upload
var img = document.getElementById('camera_image');
// var imageURI = img.src;
//"/data/data/com.suave.nexttrainer/app_database/file_0/0000000001.db";
//i am giving physical address of database of simulator here
var imageURI = "/data/data/com.suave.nexttrainer/app_database/file_0/0000000001.db";
// Verify server has been entered
server = document.getElementById('serverUrl').value;
alert('server');
if (server) {
// Specify transfer options
var options = new FileUploadOptions();
options.fileKey="file";
options.fileName=imageURI.substr(imageURI.lastIndexOf('/')+1);
options.mimeType="image/jpeg";
options.chunkedMode = false;
// Transfer picture/file to server
var ft = new FileTransfer();
alert('ft');
ft.upload(imageURI, server, function(r) {
document.getElementById('camera_status').innerHTML = "Upload successful: "+r.bytesSent+" bytes uploaded.";
}, function(error) {
document.getElementById('camera_status').innerHTML = "Upload failed: Code = "+error.code;
}, options);
}
你解决这个问题 – Aravin 2014-12-09 12:56:52