2013년 3월 22일 금요일

Simon Mac Donald: PhoneGap file uploader error code 3

Simon Mac Donald: PhoneGap Bluetooth Plugin Updated

Hello Simon.
I think phonegap is very useful and I used often it.
BTW, I have developed one project to capture image and upload to server.
At first, It looks seems like works well.
But After uploading first thing, when I try to upload again, then it occurs error code 3.
Then I upload it , it works well again.
After it, when I try upload , then it occurs error code 3.
As this way, that app works and occurs error step by step.
I can't know really this reason.
Here is my functions.


function getImage(type) {/// capture image from camera
   
    localStorage['uploadtype'] = type;
     navigator.camera.getPicture(uploadPhoto, function(message) {
         alert('get picture failed');
     }, {
         quality: 100,
         targetWidth: 500,
         targetHeight:700,
         destinationType: navigator.camera.DestinationType.FILE_URI
     });
   
}


function uploadPhoto(imageURI) {
   
    $.mobile.showPageLoadingMsg("b", "Uploading...", false);
    var options = new FileUploadOptions();
    options.fileKey="file";
    options.fileName=imageURI.substr(imageURI.lastIndexOf('/')+1);
    options.mimeType="image/jpeg";
    options.cardtype= localStorage.uploadtype;
    options.uid= localStorage.uid;

    var params = new Object();
    params.type = localStorage.uploadtype;
    params.uid = localStorage.uid;

    options.params = params;
    options.chunkedMode = false;
    alert("uid:" + localStorage.uid + ", imageuri: " + imageURI);
    var ft = new FileTransfer();
    ft.upload(imageURI, encodeURI("myserver.com/upload.php"), win, fail, options, true);
 
}

Please help me.
Thanks.
Han