JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.
We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.
How do I Insert the Name of an Uploaded File Into Another Field?Asked by Luxion on July 07, 2015 at 06:01 PM
Hi, I've tried various way hinted at on the forum to get the filename of an uploaded file. The Form Calculation widget doesn't return a value and nothing else seems to work.
What is the best way to get this info?
Please upload any file of your choice to this jotform and notice how the filename appears in the Name of uploaded file text box. Here's how this was achieved:
1. After the Name of uploaded file field was added to the form, I created the following Update a form field value (see this screenshot) condition:
2. (Optional step) After saving the condition, the Name of Uploaded file field was set to read-only by going into its properties and selecting Yes for Read-only as illustrated in the following example:
That's pretty much all that was done to have the filename displayed in the text box. Cloning the demo form to your account and examining it may help to clarify the above but if you need further help with this, please inform us.
This guide should be helpful. However, in this instance the Add Field button was clicked to insert the Upload a file "button" into the condition's work area:
Ok, thank you. I'm able to show it in the form, but how can you pass it along when the form is submitted?
You can set the name to be outputted in a hidden field or a readonly field as directed by my colleague, by default all fields will be included in your submissions data.
kindly let us know if you need further assistance or clarification
Ok, I see that it's working when I test it in JotForm. I am using the raw code on the site though, so it looks like I'm missing the proper script. What script do I need to call?
Since you are using the full code embed you will have to get a fresh copy of the code with the implemented changes.
The full source code usually requires manual updating for the changes to reflect'
Kindly let us know of the outcome
Ok, so we determined that it's three scripts being called, yes, in the full code embed. I did need to make some updates to the form, but once the script was added, the filename input is showing up. Thanks for your help.