How to upload an image file to zoho creator from javascript

I am using javascript with three.js library for developing a web application. In that, I need to capture the canvas as image and upload it to zoho creator. According to my survey, it requires to build a body for this. But I don’t know about that.How to do that? Please help me.

is this what you mean? this might help you

1 Like

Thanks for your reply :blush:. But the conversion is not a problem. Upload to zoho creator is the problem.

so you need to upload it straight from your application? im not even sure what zoho creator is but you will most likely have to use their api if they do that, if not and you want to upload manually then that video shows how to download it as an image so you then upload it manually

Zoho creator having api for file upload. It doesn’t allow cross origin. So I think I need to use post method of PHP. will php is useful for that?

have you allowed cross origin in your code? you can allow it in the header or params depending on what your using to to make requests sometimes adding origin=* to the url works too

yaa :smiley: . That only I need to know. How to allow cross origin in my code. Please say that

Access-Control-Allow-Origin: *

add that to your header in your api request more info here

Actually, I don’t know how to form the request with header and other necessary things. Can you please share an example script

@biscuitmanz Can you please share a sample request ?

what are you using to make requests?

I am using AJAX for that.

    type: "post",
    headers: {"Access-Control-Allow-Origin": "*"},
    url: "your url"
}).done(function (data) {

var xhr = new XMLHttpRequest();"post", "your url", true);
xhr.setRequestHeader("Access-Control-Allow-Origin", "*");
xhr.onload = function () {

more info here…#

i usually use axios so im not used to these methods sorry

Thanks a lot @biscuitmanz :blush:

So Can I use that method for my use?

i use axios for vue.js you shouldn’t need it if your already using ajax with normal javascript you be better using jquery ajax if anything

Oh Okay @biscuitmanz . Thank you so much

did the cross origin still not work?

yes @biscuitmanz. Thanks for asking. Now it shows following error , “Uncaught (in promise) TypeError: Failed to execute ‘decode’ on ‘HTMLImageElement’: Illegal invocation”