May 26, 2020 02:38 PM
I have a table that is suppossed to create records for file attachment and other details.
Juding from code below, How do I attach files along with other records in airtable.
Do I have to convert the file to base64 or just upload the files to a remote server and then add the file links in the record.
How does air table programmatically handle files attachments be it photos, pdf, videos etc. can someone help me out with the code below
Thanks
const files_tab = base.getTableByNameIfExists('myfiles_table');
const ok = files_tab.createRecordAsync({'title': 'file title','description': 'file details', 'myfile': 'my file attachment goes here'});
Solved! Go to Solution.
May 27, 2020 09:59 AM
You should be able to add any URL that points to a file in the value for ‘myfile’ (which assumes you have a Field with the same name). This custom block documentation describes the parameters for multiple attachment fields.
This would assume the file is located at an addressable URL (already uploaded somewhere on the internet). It doesn’t appear that custom blocks directly supports file input yet (the scripting block does with input.fileAsync
. However, one of the custom block examples, JSON Import Block includes this functionality, much of which can be seen in the open source GitHub repo (this file in particular seems relevant to your problem).
If this answers your question, please consider marking it as “solution”. If not, I’m happy to work with you further. Thanks!
May 27, 2020 09:59 AM
You should be able to add any URL that points to a file in the value for ‘myfile’ (which assumes you have a Field with the same name). This custom block documentation describes the parameters for multiple attachment fields.
This would assume the file is located at an addressable URL (already uploaded somewhere on the internet). It doesn’t appear that custom blocks directly supports file input yet (the scripting block does with input.fileAsync
. However, one of the custom block examples, JSON Import Block includes this functionality, much of which can be seen in the open source GitHub repo (this file in particular seems relevant to your problem).
If this answers your question, please consider marking it as “solution”. If not, I’m happy to work with you further. Thanks!