Jul 21, 2020 02:17 PM
First post here after doing a bit of googling to no avail…
I’m looking for an example of how to upload a zip archive to an attachment field. In the documentation there is mention of attachment objects but no mention of how to create one pro-grammatically. Any sample code or general guidance would be helpful regardless of language although Python would be greatly appreciated!
Jul 21, 2020 05:23 PM
Welcome to the Airtable community!
In order to upload an attachment with the API, the attachment must first exist at a publicly accessible url. So, you must first upload your attachment to some other web service, get the url for it, then use that url with your create/update request.
Jul 21, 2020 07:04 PM
Are you saying that AirTae will transfer the file from the public endpoint to its own storage? I’m not looking to create an external link via the attachment object. What I am looking for is a way to upload a file to AirTable in much the same way AirTable’s drag and drop web UI does it when one attaches a file uploading from a local device. When one uploads a file in this way an attachment object is created which has a url that points to https://dl.airtable.… Is this a web UI feature only? I do not want these files to be public and I’d prefer not to have to click around in the UI to accomplish this task.
Jul 21, 2020 07:53 PM
Yes, Airtable will retrieve the file from the public url and make its own copy to store as an attachment. Once the attachment is uploaded, you can delete the public version. The attachment create with the API will also work exactly as any other attachment created in the UI.
Jul 21, 2020 08:10 PM
@UME_System Since you mentioned concerns about your attachments being public, one thing you should note is this:
Once your attachments are in Airtable, and once a user of your Airtable base has access to the https://dl.airtable URL of an attachment, that attachment will always be publicly visible via that URL to anyone who gets hold of that URL… even if you delete the attachment from Airtable.
Even if you delete the attachment from Airtable, the attachment lives on publicly at that URL for an indefinite amount of time (presumably 1 year, if you are on the Pro plan).
But that https://dl.airtable URL does not sit behind any type of security. If a user distributes that URL to the general public, or even if the user themselves goes back to that URL a year later, the attachment will still be visible.
Jan 10, 2023 09:01 AM
My question is simple, as this post has been around for a while now
Is it possible to upload a file in a field of a record without first uploading it to a non-Airtable server?