Uploading, matching, and attaching files - is this possible?

I have a table that has a text column containing filenames. Each record has a single filename in it.

On my computer, stored locally, I have a folder that is full of the actual files referenced by the filename field.

What I want to do is create a script that goes through each record, attempts to match the filename to one of the files in the local folder, and then if there is a match uploads the matching file as an attachment to the record.

Does this sound possible? Or am I dreaming impossible scripting-block dreams?

Currently, the scripting block does not have access to the local file system.

However, the scripting block can access resources on the internet. If you place the files on the web, you can upload them to an attachment field. See the scripting API reference for the write format.

1 Like

This was also announced recently:

Maybe it would help?

2 Likes

While input.fileAsync does let users upload files, I don’t see a way to upload a local file without user intervention for each file.

1 Like

Yes, this is the crux. I might have to follow your advice and upload them independently onto the web somewhere, and then upload them as attachments. Thanks for your input and valuable thoughts!

I am doing something similar but was planning to first use the gallery view bulk upload (purple X) that gives the option to create a record for each image rather than hosing elsewhere. The gallery attachment upload uses the filename as the primary field. My quandary is how to do what @hgld is asking I think - how then to match to a field name in a separate table, link and attach these images to their corresponding field name. Here are screenshots from a screencast showing how I am doing it manually with linked record. But I have 5,000 sketches I have to match up.