Forum Documentation Showcase Pricing Learn more

[SOLVED] How to upload an image using POST API

I’ve got a little app running on my desktop connecting to a test API endpoint using POST.

So far I’ve gotten text from the desktop to show up in Bubble’s database using a format like this:
first=some thing&second=another thing

I’ve also gotten an image into Bubble’s database using a format like this:
first=some thing&second=another thing&third=http://some.place.com/with/an/image.jpg

What I haven’t been able to do is get an image from the desktop into Bubble’s database.

I tried following this little blurb from the reference in two ways and it’s doing everything except uploading the image.
first=some thing&second=another thing&third={"private":false,"filename":"some_filename.jpg","content":"a string of base64 encoded image data"}

first=some thing&second=another thing&private=false&filename=filename.jpg&content=base 64 encoded image data

I wouldn’t really expect that second one to work, but figured I’d give it a try.
Bubble is returning the message I told it to in the API workflow and NOT returning any errors. The two parameters with text in them always show up in the database.

Can you share what you do in Curl, for instance? seeing the full request would make it easier to help.

Hi, @blueback09. This sounds a bit like a problem I had some time ago, albeit I was trying to upload pdf files through the API rather than images. For me I kept getting the string value of the URL for the file, rather than Bubble uploading the file into the Bubble database. You can see the issue here. For that issue, @emmanuel said that Bubble wasn’t able to provide the functionality even though the API provided the file as a potential field for receiving data via the API.

If your issue is in some manner related to the one I had, I’d like to know if this is in fact possible as I’d really appreciate being able to import files through an API call.

I’m not familiar with how to debug web traffic. I know that Curl is a library, but I’ve never used it.

I’ve been trying to use Fiddler to see what the actual request/response is, but nothing is jumping out as obviously what I should be looking at.

Is there anything in Bubble for checking the API traffic to see if it’s got problems?

Well whatever the tool you’re using is (maybe Postman?) can you show what you’re actually doing? Your first post only shows some pieces of it.

Sure, this is an IDE called Livecode. This is what I built my desktop app in and I’m trying to connect it to my Bubble app.


start using stack “easyJSON”
put “C:\Users\theyogi\Pictures\NK_Exoskeleton_B.jpg” into tFile
put URL (“binfile:” & “C:\Users\theyogi\Pictures\NK_Exoskeleton_B.jpg”) into tImage
put base64encode(tImage) into tImage64
replace numToChar(10) with empty in tImage64
set itemDelimiter to “”
put item -1 of tFile into tFilename
put tFilename into tArray[“filename”]
put “false” into tArray[“private”]
put tImage64 into tArray[“content”]
put jsonfromarray(tArray) into tMaybe
put “uno=uno&dos=dos&tres=” & tMaybe into tBody
post tBody to URL “https://howstr.bubbleapps.io/version-test/api/1.0/wf/api_test
put the result into tResult

You can see in the “it” variable that Bubble sent back a response, formatted the way I told it to. You can also see since the “tResult” variable is empty there weren’t any errors.

Here’s the database where it’s happily accepting the two text parameters but not grabbing the image. The things with images in them are where I put a URL to an online image into the POST or manually uploaded an image through the database’s editor.

and here’s my api workflow



Can you try just running that call with Postman, it’s easier and cleaner (or curl from the mac terminal), and then migrate it to your IDE. I’m not familiar with it, and with the screenshot I really can’t see what you’re sending.

When poking around I rand into the “:saved to s3” expression and realized it could be added after the parameter with the image array. So I tried that.


and something different happened; I got an error! Now the API responds with this when I try to post the image array per the reference (the text parameters still work)

{“message”:“Unexpected server error, please try again later”,“code”:“1482300718071x1311”}
{“message”:“Unexpected server error, please try again later”,“code”:“1482300942720x363”}
{“message”:“Unexpected server error, please try again later”,“code”:“1482300981403x354”}
etc

I also downloaded Postman and I’m learning how to use it.

What body type is Bubble expecting? Form data, urlencoded, etc? Or does it not matter?

Saved as s3 is not what you need here. The reference will explain what it does.

A form data is usually a good way to do this.

The reference doesn’t explain how to make any of this work.

So I tried something else and now I’ve got something that at least shows up as a broken image

When I right+click and “open image in new tab” it seems like I get a URL with the entire base64 encoded text of the image in it. It goes on like that for a while.

I got that by sending the post as formdata instead of urlencode and by converting the base64 into JSON-specific base64, because apparently that’s a thing.

Can you post an example of a properly formatted HTTP POST that actually succeeds in uploading an image using Bubble’s API workflow? I assume someone must have done it, otherwise the reference wouldn’t say it’s possible. That would give me something to compare to.

I think I’ve got the same POST built in Postman. The result is an error. Since this is an app you seem familiar with, can you point out where I’m going wrong?

The exact same Postman post WITHOUT the file works just fine

1 Like

This one I tried copying the raw body Postman generates from the formdata dropdown builder and pasting it into the raw option. I manually added parameters like “filename” but I’m not sure how to add the actual file data. In this one the API workflow did create a new thing, but it didn’t put any information into it, even though the text parameters are clearly still there like before.

I tried the “binary” body option but that just gives me a “could not get a response” message.

Here is a Curl request that worked on another app.

Here you are, with a workflow called upload_image that creates a thing whose field is going to be the content of file.

curl -X POST https://yourappname.bubbleapps.io/api/1.0/wf/upload_image -H “Content-Type: application/json” -d ‘{“file”:{“filename”:“image.png”, “contents”:“iVBORw0KGgoAAAANSUhEUgAAAusAAADqCAYAAAAbOguxAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABh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S+2+fOnlXqD/232GmpICAACAz7BeJrAdU50d2IpnpgMAAGAiv2u3clxFvh0EaAAAACQZ1iX/XwQ0pVppXMoDAAAAHAzrm4i34Y7dCAAAgJTDehNpYI/1cwMAAABHh3Vp93jC2NzJzzeNAgAAAKbDeq24ng/eiOeZAwAAYCZhXdqtrteRfPZzsaoOAACAGYX1xoVg67bicY0AAACYWViXdl+SZPn69SqSCQUAAADgPaxL0lo2n7LSiMtfAAAAMPOwLheKLQX2RtIr8QVIAAAAIKybCuwEdQAAABDWHwjsIa9hryQ9I6gDAACAsH7YWruV7Xriz3ct6YW4Rh0AAACE9UeVLjhPscrevteaXQQAAADC+nEaF6CfaXctezNCSH8lrk8HAAAAeof1Vq3dtezP3J/bAZ+hlnTrXuuVC+wAAADA7P0x8Pcb7VbYN5IySYWkhaTn7u9yf29Dee3++av751LTXwcPAAAAROH/BwDSlTevI70CFQAAAABJRU5ErkJggg==”}}’

Thanks, I think we’re on the right track. If I copy the JSON array and paste it into Postman under raw, and select application/json from the pulldown, and tell my API workflow to expect a parameter named “file” to be placed into a file field in a thing, then I get an image uploaded to Amazon that displays properly in Bubble’s image element.

So far I haven’t been able to replicate that success from my desktop app. I keep getting a formatting error. First it was an unexpected token and now it’s a very specific message saying that the content for the image file is missing. That seems like a positive trend, since the server knows enough about what’s going on to give me a specific error message.

I think I got it.

The reference says to put the base64 string into “content” but the server is looking for “contents” with an “s”.

Oops you’re right, sorry about that. Will fix the reference.

For what it’s worth, I also found another way of doing things.

This post is fascinating. He’s doing some really cool stuff with javascript in an html element. One of the neat things I learned is that you can put the entire base64 content of an image into a “link”.

So something that did technically work for me was to upload the base64 into a thing’s text field with “data:image/jpg:base64,” concatenated onto the beginning. Then I put that text into an html element with this code "<img src="search for whatever:first item's text field" width="200px"/> It’s ugly and clunky and slow, but it’s an option.

2 Likes

Hokay, so, here’s what seems to be working for me:

  1. get your file (name and data)
  2. isolate and url encode the filename (somefile.jpg)
  3. base64 encode the filedata
  4. put the filename into array1[filename]
  5. put the filedata into array1[contents]
  6. put “false” into array1[private] (I haven’t tried making it private and attached to a database thing yet)
  7. put that array into array2[file] (I tried changing that but the server stopped accepting it, so apparently it has to be “file”)
  8. put anything else you need into array2[], for example “some example text” into array2[example]
  9. convert array to JSON (as required) what you end up with is something like this:
    array2={
    file={filename=file’s-name.jpg, private=false, contents=base64}
    example=some example text
    }
  10. setup your API to recognize the “file” parameter as a file and the “example” parameter as text
  11. change the headers to “Content-Type: application/json”
1 Like

Since I’m looking at it, I noticed that the reference still says “content” when it should be "contents"

1 Like

You are best to file this with a bug_report so it doesn’t get lost in the forum or forgotten.

1 Like