I'm still new and learning a lot from these forums. Here's my ask:
I would like to have the options for a dropdown be a dynamic list of file names in a mounted folder, so that if a new file is created it is automatically added to the list. The idea being that the user can link a document to an entry without a risk of a typing error. I only need the name of the documents (which will always be PDF format) for the dropdown, which will be viewed later using a PDF Viewer component. (This last part is all setup and works fine as long as the name is typed correctly).
You would need to have a gateway script poll the folder(on the os) at a set interval and record the folder/file structure to a tag, and then use that tag as the source for the dropdown list.
If you are controlling who/what is uploading to the folder, you can call the script whenever the upload finishes to keep the structure data up to date.
3 Likes
Also, while in this area, be careful about path traversal information leaks/disclosure. Make sure you're hardcoding the OS path you're listing files in, that you're only listing files N folders deep, etc. Or, at the very least, make sure you don't get tempted to put in a webdev endpoint that says "give me all the files under X path you provided me in your query"
2 Likes
Thank you.
This is a project for our internal use only and is hardcoded to a specific folder and filetype.
I've been very cautious about allowing users to input anything into queries and try to hard code as much as I can.
2 Likes