Forum Documentation Showcase Pricing Learn more

Upload Image DATA to Google Drive?

I’m trying to create a file on Google Drive by uploading media directly using this approach. The body of the post request must be the raw image data, which I have. I just don’t understand how to post it to Google’s API endpoint using Bubble.

I read a number of other posts here about uploading a file via URL, but I don’t have a URL - just the image data. Anyone know if/how this can be done?

-Steve

@neerja, do you know if this is possible?

Sure, it’s possible. You’d have to do the POST operation (described on the page you linked to) via the API Connector.

See https://bubble.io/reference#Plugins.apiconnector2 (And all sorts of discussions here about configuring various APIs – Google’s APIs are discussed quite frequently.)

There are a couple of Plug-ins for Google Drive (go to plug ins panel in your app > add plug ins and search for “drive”), one of which looks like it might be already configured to do uploads like this.

Is that where you’re stuck? Or is your question about configuring this specific API call within the connector?

Thanks for the reply, @keith. Where I’m stuck is with how exactly to post raw binary image data via the bubble API connector. This post seems to suggest that in fact it’s not possible.

Have you already tried something like this?

Gotcha. The new FILE features MAY be what you need. The only way to know would just be to try. The Google call looks like it’s expecting a file stream (or at least filestream like thing), given the resumable option…

Exactly. In Google’s scripting environment, it would be referred to as a “blob” (which I think stands for “binary large object”). The point, though, is that the body (payload) of the POST request is neither JSON nor form data - it’s just raw binary data.

Ah… hmm. I figured it might “just work”…

(I’ve only used this the opposite way ‘round: I have an API I wrote that returns a file. Bubble sends it some info and it makes the file and returns it to Bubble. I guess maybe it doesn’t support the converse yet, but it seems like there must be a way…)

There could well be some undocumented functionality. I’ll fiddle a bit when I get a chance. Thanks for the help.

Thanks, @mebeingken. I have not tried that, but only because I wouldn’t expect it to work, given the documentation for the call. I’ll mess around a bit, though, just in case.

It kinda sorta “has to” work as, in this context, a “file” means there’s a thing that can stream blobs on the Bubble end that’s sending the file.

[edit: though it isn’t entirely obvious to me what the Google call is expecting… but it sounds like a file stream. Why don’t they just say that? Hooray, obtuse API documentation!]

Hey @shot

Try adding a header to match your file type, example :
Content-Type: image/jpeg

List to choose from is here:

If it still doesn’t work, maybe Bubble is sending it as a multi part upload, in which case adding the query parameter might help:
uploadType=multipart

EDIT - looks like Bubble sends multi part upload, so don’t add content type, just the query params.

@mishav, I’d been assuming the content type is automatically set based on the body type chosen in Bubble. The only two options seem to be JSON and form data.

Hi Steve, did you get it working? What configuration did you put in the API connector, and what errors did you receive?

Thanks for following up, @mishav. Unfortunately, I haven’t had the time to fiddle with it yet.

The Google API docs seem pretty clear to me, though. The content type must be the image MIME type (image/png in my case), and the binary image data must constitute the body of the POST request. It just doesn’t seem that Bubble supports this currently.

To make the upload of the image data to the google drive can be done by following the process given here. I was also not know to this and I got to know from here. But when I tried to for the first time, it showed ERROR CODE 0XC0000428 on the screen.

Hi keith, I am trying to upload jpg file to Bubble using a python script. So far, i did not succeed. And I do not understand where is a problem. Do you upload file as URL or as row data? Could you share part of your code which does it? Thanks in advance.

Hi @kirill_anikin,

This thread is about uploading to Google Drive using Bubble’s API Connector. If you’re trying to upload to Bubble AWS S3 storage, you might want to search the forums for that, or start a new topic.

Here’s one post which points to the relevant portion of the docs.

Thanks a lot, shot )