Cordova/Phonegap-FileTransfer.Upload (hochladen) Fehler-code = 1 (FILE_NOT_FOUND_ERR)

Was wirklich verwirrend ist, wenn ich capture das Bild mit der Handy-Kamera, ich benutze FileTransfer.moveTo es und schickt das Bild in einen bestimmten Ordner auf meiner SD-Karte, wie gewünscht. Ich habe auch immer eine Liste von Bild-Objekten in localStorage etwa wie folgt aussieht:

[
Object
ean: "42208556"
image: "file:///storage/sdcard0/PhotoscanPhotos/d51b5b77-aab1-9947-096d-b0a92dfb87eafoto.jpg"
timestamp: 1396441761000
__proto__: Object
etc etc

Als Teil meiner app, ich benutze das gleiche Bild[i].Bild als src-Attribut dynamisch hinzufügen von Bildern in eine Liste, und es funktioniert gut. Allerdings werden bei Verwendung der gleichen parameter für FileTransfer.upload gibt mir den obigen Fehler.

Meine Funktion ist eine in der Nähe von Replik der API-docs (Cordova 3.1). Code ist wie folgt:

function uploadImagesAsJpegs(imageObject) {
    var options = new FileUploadOptions();
    options.fileKey = "file";
    options.fileName=imageObject.image.substr(imageObject.image.lastIndexOf('/')+1);
    //alert(options.fileName);//debugging ............we're happy with this
    options.mimeType="image/jpeg";
    options.chunkedMode = true;

    var serverUrl = http://172.17.7.112/mylocalserver;


    var params = {};
    params.value1 = ean;
    params.value2 = imageObject.timestamp;

    options.params = params;

    var fileTransfer = new FileTransfer();

    //alert(encodeURI(serverURL));//debugging  ............we're happy with this
    //alert("image to upload is: " + imageObject.image);//debugging............we're happy with this
    fileTransfer.upload(imageObject.image, encodeURI(serverURL), onUploadSuccess, onUploadFail, options);
}

InformationsquelleAutor rory | 2014-04-02

Schreibe einen Kommentar