Uploading Images via HTTP

Hey there,

I’m trying to upload images to my team’s Dato Media area but am facing some issues with the uploading to S3 portion of the docs.

I’m using AppSmith to accept image inputs which they return to you in either base64 or binary form meaning that I can’t use the Node client, as there’s no local file, nor is there any URLs.

I’ve followed the steps and get an upload_id at the very end of them, but the upload_id returns a 404 when trying to retrieve the upload via the API.

I have an incredibly simple fetch implementation for the step 2 as seen below:

 await fetch(uploadURL // generated from step 1, {
    method: 'PUT',
    body: binaryImage // Binary generated from converting a base64 image using atob()

I have a feeling that I’m missing some headers but I have no idea. Any help would be greatly appreciated!



hello @benjamincbialy and sorry for the delay!

Maybe you have figured this out already, but I think you should send at least the content-length and possibly also the content-type:

    headers: {
      "Content-Type": "image/png",
      "Content-Length": totalLength,

I’m getting the length like so: const totalLength = fs.statSync(filePath).size;

Let me know if you need anything else

1 Like

Hey Matteo, no problem at all!

Support was able to provide us with that solution via email, we greatly appreciate your team’s support and dedication!


1 Like