Page 1 of 5

Wrong type for parameter "undefined" of FileTransfer.upload: Expected String

Posted: Thu Jul 24, 2014 3:50 pm
by adam griffin

I get this error when trying to upload a file. I am using the same camera services for two different uploads. I use a if statement to tell the two different uploads apart. I set the data.imageURI to localStorage. And use a function to call the FileTransfer upload. This is snippets of the code im using:

/Choose witch file is uploading/
if(localStorage.getItem("photoType")==1){

Code: Select all

 localStorage.setItem("TEMP_profile_url",String(data.imageURI)); 

}
else if(localStorage.getItem("photoType")==0){
localStorage.setItem("TEMP_background_url",String(data.imageURI));

}

/SOME OTHER CODE/

/Function that will be doing the uploading/
function sendProfile(){
alert("Called Profile");
var ft = new FileTransfer();
ft.upload(localStorage.getItem("TEMP_profile_url"), uri, win, fail, options);
}

function sendBackground(){
alert("Called Background");
var ft2 = new FileTransfer();
ft2.upload(localStorage.getItem("TEMP_background_url"), uri, win2, fail, options);
}


Wrong type for parameter "undefined" of FileTransfer.upload: Expected String

Posted: Thu Jul 24, 2014 5:06 pm
by Evgene Karachevtsev

Hello Adam,

Please clarify are these variables defined: uri, win, fail, options?
Please check, do you call the function that you need? You should debug your application and look for what is wrong - what variable is not set.


Wrong type for parameter "undefined" of FileTransfer.upload: Expected String

Posted: Thu Jul 24, 2014 5:12 pm
by adam griffin

I think it is talking about the first parmeter. Uri,win,fail, and options are funcitions that I declare else where. They work perfectly. When I replace the first if statement with var file = data.imageURI; ft.upload(file, uri, win, fail, options); Everything is ok. Is something change when I set the data.imageURI to localStorage?


Wrong type for parameter "undefined" of FileTransfer.upload: Expected String

Posted: Thu Jul 24, 2014 7:33 pm
by Evgene Karachevtsev

Adam,

Everything seems to be right. Please check what is recorded in your local storage. Before calling method .upload you should do alert of corresponding local variable storage


Wrong type for parameter "undefined" of FileTransfer.upload: Expected String

Posted: Mon Sep 08, 2014 4:20 pm
by adam griffin

I checked the variable and it shows the image file location on my device. I don't know what the problem can be. Could you guys take a look at it?


Wrong type for parameter "undefined" of FileTransfer.upload: Expected String

Posted: Mon Sep 08, 2014 4:40 pm
by Kateryna Grynko

Hi Adam,

Sure. Could you please share the app and send steps to reproduce?


Wrong type for parameter "undefined" of FileTransfer.upload: Expected String

Posted: Mon Sep 08, 2014 4:59 pm
by Kateryna Grynko

Hi Adam,

Please try outputting values of localStorage.getItem("TEMP_profile_url") and uri for sending profile.


Wrong type for parameter "undefined" of FileTransfer.upload: Expected String

Posted: Fri Sep 12, 2014 4:20 pm
by adam griffin

Wrong type for parameter "undefined" of FileTransfer.upload: Expected String

Posted: Fri Sep 12, 2014 4:22 pm
by adam griffin

Wrong type for parameter "undefined" of FileTransfer.upload: Expected String

Posted: Fri Sep 12, 2014 4:26 pm
by adam griffin

This what is displayed in the localStorage.getItem("TEMP_profile_url")