Page 1 of 1

Uploading Files not working

Posted: Fri Oct 24, 2014 10:47 am
by izozzy

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?


Uploading Files not working

Posted: Fri Oct 24, 2014 12:14 pm
by Evgene Karachevtsev

Hello!

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


Uploading Files not working

Posted: Fri Oct 24, 2014 1:56 pm
by izozzy

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...

Uploading Files not working

Posted: Fri Oct 24, 2014 2:03 pm
by Evgene Karachevtsev

Izozzy,

Could you please detail its name?


Uploading Files not working

Posted: Fri Oct 24, 2014 2:04 pm
by izozzy

app is called Marriage Bureau


Uploading Files not working

Posted: Mon Oct 27, 2014 12:58 am
by Yurii Orishchuk

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.


Uploading Files not working

Posted: Fri Oct 31, 2014 11:38 am
by izozzy

Do you know when this bug will be fixed?


Uploading Files not working

Posted: Fri Oct 31, 2014 11:59 am
by Maryna Brodina

Hello!

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