Page 1 of 1

Send the input document as BASE64 via REST API

Posted: Mon Sep 16, 2019 8:53 am
by jemiris
Hi,

I have some doubts in the input document. Is there any way to send the input documents as a base64. Since im using REST API to post the file. could you provide me any solution?

Re: Send the input document as BASE64 via REST API

Posted: Mon Sep 16, 2019 6:57 pm
by amosbatto
Sending documents as base64 worked the last time I tried it (2 years ago) with REST, but why do you need to send as base64? What language are you using?

Re: Send the input document as BASE64 via REST API

Posted: Mon Sep 16, 2019 11:53 pm
by jemiris
I have a number of files to be uploaded if it's any numbers of files it will take time so I would like to convert the image as a base64 and send. Could you give me any solution

Re: Send the input document as BASE64 via REST API

Posted: Tue Sep 17, 2019 6:35 pm
by amosbatto
What programming language are you using? Can you explain where the files are coming from? It is hard for me to help you without knowing the context.

Re: Send the input document as BASE64 via REST API

Posted: Tue Sep 17, 2019 11:51 pm
by jemiris
Yes i'm using vue js to load the data.

Re: Send the input document as BASE64 via REST API

Posted: Wed Sep 18, 2019 10:16 pm
by amosbatto
Sorry, but I don't know vue.js very well.

Dealing with files in JavaScript is not recommended. It is much easier to do this using PHP or some other server-side language. If you are using Firefox, then there is a nice File API. The other browsers are difficult. See:
https://stackoverflow.com/questions/750 ... s-browsers

After you get the contents of the file, then you can convert it to base64 using atob() and then send it to the REST endpoint.

Frankly, I think you should use PHP, so you don't have to deal with base64.

Re: Send the input document as BASE64 via REST API

Posted: Thu Sep 19, 2019 12:49 am
by jemiris
yes i use php thanks for the information