How to Display a Selected Image File Name in an Acrobat PDF Form
Question details
The user wants to automatically display the file name or path of an image when it is selected and inserted into an image field within a PDF form.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating or filling out interactive PDF forms that require users to upload images and display their corresponding file names next to them.
- Observed behavior
- Acrobat lacks a built-in function to show the file name of an inserted image in a separate text field, requiring complex custom JavaScript workflows and folder-level scripts.
Ensure you have access to Adobe Acrobat Pro to write and execute custom JavaScripts for PDF forms. Basic knowledge of JavaScript is recommended before attempting to create custom form actions.
Use Custom JavaScript to Capture and Display the File Path
Write a custom script that selects the image file, extracts its path, and populates a designated text field with the name.
Because Acrobat does not have a native toggle to display image file names, you must use a script to extract the file path during the selection process. Please note that importing images via script often requires folder-level permissions installed on each user's local computer, which might be restricted by standard Acrobat security policies.
Open your PDF in Acrobat's Prepare Form mode. Create an image field for the photo and a separate text field (e.g., named 'FileNameText') where the file name will be displayed.
Right-click the image field or a dedicated trigger button, select 'Properties', and navigate to the 'Actions' tab.
Choose 'Run a JavaScript' from the Select Action dropdown menu and click the 'Add' button to open the JavaScript Editor.
Input a custom script utilizing Adobe's JavaScript APIs (such as app.browseForDoc) to prompt the user to select a file. The script must extract the file name from the returned path string.
Include code in your script to set the value of 'FileNameText' to the extracted string, and then import the selected file as the icon for the image field.

Edit and Manage PDFs Easily with WPS Office
While advanced JavaScript workflows in Acrobat can be complex and restricted by security policies, WPS Office provides a lightweight, user-friendly PDF editor alongside its Word, Excel, and PowerPoint alternatives. It offers seamless format compatibility and an intuitive interface for all your document needs.

Frequently Asked Questions
Can I display the image file name in Acrobat without using JavaScript?
No, Adobe Acrobat does not currently offer a built-in feature or simple toggle to display the file name of an image inserted into an image field. Custom JavaScript is the only workaround.
Why does my JavaScript for importing images fail on other computers?
Importing images via JavaScript often requires folder-level scripts to be installed on the local machine. Acrobat's security policies restrict document-level scripts from accessing the local file system directly to prevent malicious activity.
Is there an AI tool in Acrobat that can automatically add file names to photos?
Currently, the AI assistant in Acrobat is designed for summarizing and querying document text, not for executing complex form field actions or modifying image metadata displays.




