adam griffin
Posts: 0
Joined: Tue May 21, 2013 8:44 pm

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

I invited a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a. To reproduce the issue. Click sign up from the start screen and follow the steps to you get to the page where it ask for profile picture and background. Choose one for each then click "save photo" the error should appear soon after. Let me know if this helps. Thank you for helping me.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

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

Hi Adam,

Please tell us your app name.

Thanks & regards.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

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

Hello!

I am sorry for delay! Working on your request.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

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

Hello Adam,

You have such functions

function sendProfile() {
toast("Profile Called: " + localStorage.getItem("TEMP_profile_url"));
var ft = new FileTransfer();
ft.upload(localStorage.getItem("TEMP_profile_url"), uri, win, fail, options);
}

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

It is not correct to override the variables ft and ft2. You have created them above. If I remove the lines
var ft = new FileTransfer();
and
var ft2 = new FileTransfer();

and call the appropriate function, then I have everything running on Android 4.2.2
Sometimes there are errors with different codes. I don't know why, maybe the errors of the Internet, maybe something else. But if I send the same file, everything works. I recommend for transfer errors trying to send again the same file and everything will work fine.

adam griffin
Posts: 0
Joined: Tue May 21, 2013 8:44 pm

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

So should I just use 'var ft = new FileTransfer();' not both?

For example:

Hello Adam,

You have such functions

function sendProfile() {
toast("Profile Called: " + localStorage.getItem("TEMP_profile_url"));
var ft = new FileTransfer();
ft.upload(localStorage.getItem("TEMP_profile_url"), uri, win, fail, options);
}

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

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

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

Adam,

You determine ft and ft2 above

var uri = encodeURI("https://api.appery.io/rest/1/db/files/" + options.fileName);
var ft = new FileTransfer();
var ft2 = new FileTransfer();

So you can simply write

function sendProfile() {
toast("Profile Called: " + localStorage.getItem("TEMP_profile_url"));
ft.upload(localStorage.getItem("TEMP_profile_url"), uri, win, fail, options);
}

function sendBackground() {
toast("Called " Background");
ft2.upload(localStorage.getItem("TEMP_background_url"), uri, win2, fail, options);
}

But since there is no difference in functionality between ft and ft2, you can easily remove

var ft2 = new FileTransfer();

and use ft and sendProfile and sendBackground

adam griffin
Posts: 0
Joined: Tue May 21, 2013 8:44 pm

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

I'm confused on what I am suppose to do. I removed:

var ft = new FileTransfer();
var ft2 = new FileTransfer();

When trying to upload the file it says that upload is undefined. I then tried to use just ft for both functions and it says the same as it did with ft and ft2. How do my code need to look??

adam griffin
Posts: 0
Joined: Tue May 21, 2013 8:44 pm

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

I think you are looking at the wrong part. The actual functions are in a JavaScript file called "temp_upload". For some reason the functions in the data tab will not execute.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

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

Hello Adam,

Could you please detail, where have you deleted
prevar ft = new FileTransfer();
var ft2 = new FileTransfer();/pre
After
prevar uri = encodeURI("https://api.appery.io/rest/1/db/files/" + options.fileName);/pre
please return these lines in place. You shouldn't re-create the variables ft and ft2 inside a function.

Return to “Issues”