Uploading image file as base64

Hello.
I want to upload images from the camera roll and device camera to my server.
Lighter images from the camera roll (downloaded) are not a problem to pass, but heavier images taken with the device camera generate a base64 string too big for the server (PHP) to catch (413 Request Entity Too Large). My server is hosted by Domeneshop (Domainnameshop) and they do not provide access to php.ini which would’ve made for a quick fix (increasing the allowed limit of characters).
How do you reckon I go about this issue?

Thanks in advance.

Please check if one of these suggestions could help you.

Ok thank you!
But if I use Anders Bondehagen’s first example using fetch, will the image be sent by POST as a part of $_FILES as a file?

Judging from the following line, it will be sent by POST, yes.

fetch('http://<your_uri>', { method: "POST", body: buffer });

As for the $_FILES part, I really don’t know; is that a PHP thing? The buffer there comes from ImageTools.getBufferFromImage so maybe knowing that helps you?

Yes $_FILES is a PHP thing to grab files submitted from a form. From what I can tell by googling “ArrayBuffer” it seems like the image is converted into an array instead of a base64 string, so this might work. I’ll give it a try and let you know the result

Hello
Will it have succeeded on the server side?
could you help me?