Javascript File Upload Async Callback Not Working

I’m having trouble getting the async callback to work for a javascript file upload. A file is uploaded but the callback is never called. I even downloaded the code generated version and it’s not hitting the callback function. Any suggestions?

Hello, Phil!
Can you tell us what browser do you use and do you have any error in browser console while executing the code?
The thing is that if cross-origin resource sharing is not enabled - callback wouldn’t be executed. It might be a reason of your problem.
best regards,
Alex Navara

I’m using google chrome and, yes, that is the error I’m getting. “No ‘Access-Control-Allow-Origin’ header is present on the requested resource.” Is there something I can do to get around this?

Yes, you can install Chrome extension:

Try executing your request again after installation.

I’m not seeing the error anymore but the callback still isn’t being called.

We’ve found a bug in our docs - signature for upload method is not correct.Can you try calling the upload method in the following way: Backendless.Files.upload( files_to_upload, path, true, callback), where the third argument is an “overwrite” flag. If it’s set to “true” - existing file with same name would be overwritten, or exception would be thrown otherwise.

It worked! Thanks.

We apologise for this issue.

Docs would be updated soon.
Thank you!