Help

Image upload from G.Drive returning incorrect file type, despite my efforts.

2657 7
cancel
Showing results for 
Search instead for 
Did you mean: 
r_s
5 - Automation Enthusiast
5 - Automation Enthusiast

Within an HTML form, my users must submit a photo that is critical for validating accompanying data in the submission, but I cannot get Airtable to recognize my attachment as an image.

The form is processed with Google Apps Scripts, saving the image to my Google Drive (w/ public permissions), returning the newly created url. I then pass that URL to Airtable via a webhook and the file is uploaded in the appropriate field, however, I cannot get Airtable to recognize the file as an image. Instead, it's given a type of 'text/html' with the name of 'convert' (the name is of no concern, only mentioning it in case it helps to expose the issue).

Ive tried creating/saving the file to my Drive as a blob & base64 -- I've tried setting the file type upon saving to Drive and I've tried without -- all successfully saving as images to Drive, but not once recognized as an image in Airtable. I've tried sending the Drive url as-is and I've also tried removing some of the included paramters.

I'm at my wits end with this and at this point, it's become personal. Can someone please shine some light on what it is I am doing incorrectly and what I need to do to correct it?

 

7 Replies 7

In order to send an attachment file from Google Drive to Airtable:

1. The file needs to be publicly accessible to a user without logging into Google Drive.

In Google Drive, the proper permissions are as follows:

- The type has to be set to “anyone”.
- The role has to be set to “reader”. 

2. The URL has to lead to the actual file itself, not a web sharing wrapper page URL.

It seems like you prefer scripting & writing custom programming code, but for other people who are reading this thread in the future, this entire process is extremely easy to accomplish in a no-code way (that doesn’t require any programming code at all) by using Make’s Google Drive modules and Make’s Airtable modules.

r_s
5 - Automation Enthusiast
5 - Automation Enthusiast

@ScottWorldThanks for taking the time to reply and share some info. I'm able to open the url in a private browser window and successfully view the image w/o being prompted to sign in to Google, so no issue there.

What's interesting though are the permissions you mention, those are not what is available for me. I believe my permissions are set to 'public' and 'view' with the full description along the lines of "link is public, anyone with the link can view the file"  --> ill verify shortly and report back.

I did inspect the page that is successfully displaying the image, looking for a direct image url as i saw mention of a wrapper causing issues, but to no avail. Once the file is loaded to Airtable and I attempt to open it, Im greeted with a loading 'wheel' that doesn't resolve. Opening the same url anyewhere else dose not redirect and promptly displays the image.

I feel sending an image from Drive isnt anything special and a rather common use-case, I cant believe I'm having such a hard time with it.

Im thinking im missing something basic as I cant find much on others experiencing the same issue. Ive been using Airtable for 8 years and have never felt so lost on something seemingly so basic.

What is the URL of the image?

r_s
5 - Automation Enthusiast
5 - Automation Enthusiast

I've included a few photos as well:
- show the console and response when uploading file to gDrive and returning the URL
- show viewing the img URL in the browser while not logged into gDrive.
- show Airtable grid view with files uploaded & the default title of 'convert'

** note: the test image I am using here is that of the Airtable logo.

https://drive.google.com/file/d/1u9KyvWP0xOyL02F9bPVSyl6TYjH_H63g/view

driveSave-rtnUrl.pnggUrl-imgDisp.pngtext_html-convert-gridView.png

r_s
5 - Automation Enthusiast
5 - Automation Enthusiast

you were indeed correct earlier in your observation that outside of gApps Scripts no 3rd party implementations are in my stack;  it must remain this way. 

Oh, did I also forget to mention that if you're able to help me resolve this, I'll graciously be buying the beers, no good deed goes unrewarded here  :  )

ScottWorld
18 - Pluto
18 - Pluto

That is not the correct link to the image. That is a "Google Drive share link" that takes you to a shareable web page that is a Google Drive wrapper page around the image.

You can tell because you're not just seeing the image in your web browser, but you're seeing a login button and a whole bunch of other things on the screen besides the image itself.

So you're not pointing to an image, you're pointing to a web page.

You will need to get the "web content link", which takes you to the image itself.

The "web content link" would look something like this — notice how this just takes you to the actual image itself, with nothing else added to the web page:

https://drive.google.com/uc?id=1ksFJZgtRdRIg2mtifXEqJ8ILtVafezwx

I'm sure that you have a valid reason for writing custom programming code to do all of this, but in the world of no-code databases like Airtable, it seems like you're making this much harder on yourself than necessary. For example, if you were using Make to do this, it would take you a few seconds to setup, and you could just point & click on the link that you wanted to use: either the "web content link" or the "Google Drive share link".

Oh, I just saw your post that you do not want to use any 3rd-party apps. For your own enjoyment, you may want to check out Make to see how easy they have made connecting & communicating & integrating with APIs. Also, check out this thread that I created which helps people get acquainted with Make.