# Populate Dropdown with File Names from Webdev mounted folder

**URL:** <https://forum.inductiveautomation.com/t/populate-dropdown-with-file-names-from-webdev-mounted-folder/91427>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [June 5, 2024, 5:31pm UTC](https://forum.inductiveautomation.com/t/populate-dropdown-with-file-names-from-webdev-mounted-folder/91427 "2024-06-05T17:31:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kevin\_Flener](https://avatars.discourse-cdn.com/v4/letter/k/74df32/32.png) [@Kevin\_Flener](https://forum.inductiveautomation.com/u/Kevin_Flener)\
**Post date:** [June 5, 2024, 5:31pm UTC](https://forum.inductiveautomation.com/t/populate-dropdown-with-file-names-from-webdev-mounted-folder/91427/1 "2024-06-05T17:31:27Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [June 5, 2024, 6:01pm UTC](https://forum.inductiveautomation.com/t/populate-dropdown-with-file-names-from-webdev-mounted-folder/91427/2 "2024-06-05T18:01:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 5, 2024, 6:44pm UTC](https://forum.inductiveautomation.com/t/populate-dropdown-with-file-names-from-webdev-mounted-folder/91427/3 "2024-06-05T18:44:19Z")

</div>

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" 😅

---

<div class="post-metadata">

**Author:** ![Kevin\_Flener](https://avatars.discourse-cdn.com/v4/letter/k/74df32/32.png) [@Kevin\_Flener](https://forum.inductiveautomation.com/u/Kevin_Flener)\
**Post date:** [June 5, 2024, 6:52pm UTC](https://forum.inductiveautomation.com/t/populate-dropdown-with-file-names-from-webdev-mounted-folder/91427/4 "2024-06-05T18:52:13Z")

</div>

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.
