Cordova 如何使用phonegap的文件传输api将000000001.db文件上传到服务器?

Cordova 如何使用phonegap的文件传输api将000000001.db文件上传到服务器?,cordova,Cordova,我正在使用phonegap的文件传输api将000000001.db文件上载到服务器,但它给了我错误 找不到文件错误代码=1 有人能帮我解决这个问题吗 function uploadFile() { alert('uploading file'); // Get URI of picture to upload var img = document.getElementById('camera_image'); // var imageURI = img.src;

我正在使用phonegap的文件传输api将000000001.db文件上载到服务器,但它给了我错误 找不到文件错误代码=1 有人能帮我解决这个问题吗

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);
    }
两件事:

1) 试用

“var imageURI=”file:///data/data/com.suave.nexttrainer/app_database/file_0/0000000001.db“


2) com.suave.netxtrainer是您的应用程序包吗?因为只有该应用程序才能从该目录读取数据。

我很喜欢,但在我的日志cat中显示了这一点。02-20 01:50:51.194:E/FileTransfer(1624):{“target”:“http:\/\/nextrainer.com\/nextdbbackup\/upload.php”,“source”:”文件:\/\/\/data\/data\/com.suave.nexttrainer\/app\u database\/file\u 0\/000000000 1.db,“代码:1}02-20 01:50:51.194:E/FileTransfer(1624):java.io.FileNotFoundException:/data/data/com.suave.nexttrainer/app\u database/file\u 0/0000000001.db:打开失败:enoint(没有这样的文件或目录)它是我必须上载数据库文件的服务器路径”“simon你有没有想过将0000000001.db i.e数据库文件上传到某个服务器simon你有没有想过将00000000001.db i.e数据库文件上传到某个服务器实际上我想备份数据库,比如如果设备被盗或在这种情况下损坏,我们应该备份我们的数据库..你对此怎么看???是的,你可以o但看起来您的文件路径或文件名错误。可能是我在模拟器上测试它,我知道00000000000001.db文件的默认路径,但对于设备,我不知道0000000001.db文件的路径。您知道我们如何找到该路径并将该路径提供给服务器吗?您解决了这个问题吗。