izozzy
Posts: 0
Joined: Sun Sep 14, 2014 1:37 pm

Uploading Files not working

My PhotoUpload service appears to be functioning incorrectly

I use the following code:

uploadMultipleFilesHelper(photoUploadService, Apperyio('photoInput'));

and then get the following error in the console:

TypeError Illegal invocation databaseUtils.js:23

can you help please?

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

Uploading Files not working

Hello!

Could you please clarify, have you correctly entered the names of the service and input and did you make the correct service settings?

izozzy
Posts: 0
Joined: Sun Sep 14, 2014 1:37 pm

Uploading Files not working

I have just double checked and all appears to be correctly....

I have shared the app with support...

To replicate the problem:

  1. Load the home page...
  2. Click the login in button, and use the default values
  3. Once logged in, click the new user button, this will take you to the new user form
  4. In the personal details section, you can find the file chooser
  5. No other details need to be completed...
Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Uploading Files not working

Izozzy,

Could you please detail its name?

izozzy
Posts: 0
Joined: Sun Sep 14, 2014 1:37 pm

Uploading Files not working

app is called Marriage Bureau

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

Uploading Files not working

Hi izozzy,

Unfortunatly that's a bug. We working on it.

But here is a quick workauround for you:

1 Create JS asset:.

2 Populate it with following code:

pre

function uploadMultipleFilesHelperNew(datasource, fileList) {
var isCorrectService = false;
if (datasource) {
if (datasource.service && datasource.service.requestOptions) {
var options = datasource.service.requestOptions;
isCorrectService = options.type === 'post' && options.contentType === false && /^.*\/files$/i.test(options.url);
}
}
if (isCorrectService) {
if (fileList) {
var data = new FormData();
for (var i = 0; i < fileList&#46;length; i++) {
appendItem(data, fileList);
}
try {
datasource&#46;execute({
'allowDataModification': false,
'processData': false,
'body': {data: data},
'cache': false
});
} catch (exception) {
console&#46;log(exception&#46;name + ' ' + exception&#46;message);
hideSpinner();
}
}
} else {
console&#46;warn('This data source not be supported in the method of upload multiple files');
}

Code: Select all

 function appendItem(formData, item) { 
     if (item) { 
         if (item&#46;type === 'file') { 
             item = item&#46;files; 
         } 
         if (item instanceof FileList) { 
             for (var i = 0; i < item&#46;length; i++) { 
                 appendItem(formData, item[i]); 
             } 
             return; 
         } 
         var name; 
         if (item&#46;name) { 
             name = item&#46;name; 
         } 
         formData&#46;append(name, item); 
     } 
 } 

}

/pre

  1. Ok, now you can use "uploadMultipleFilesHelperNew" instead of "uploadMultipleFilesHelper".

    Regards.

izozzy
Posts: 0
Joined: Sun Sep 14, 2014 1:37 pm

Uploading Files not working

Do you know when this bug will be fixed?

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

Uploading Files not working

Hello!

It is going to be fixed in the end of November.

Return to “Issues”