I have a form upload
I need a jQuery function that will write in a hidden text input what is written in the input file.
So I have :
<input class="addFile" id="field2" name="fileLyric" type="file" />
Whatever will be written there by the uploading (obviously the file path) should be then automatically written in a hidden text input
<input id="field2hidden" name="fileLyrichidden" type="text" style="display:none"/>
Is there a way to achieve this?
Thank you!
This will do it, but as the others already said, this will not be the full path for security reasons.
Add a change listener, so the value will be updated if the user has selected a file.
Here is a jsFiddle for demonstration. Try it in different browsers and you’ll see what you get as path.