Topic: Set initial value of File Input
Expected behavior
I want to set the initial value of the File Input field. The documentation at https://mdbootstrap.com/docs/standard/forms/file/ suggests this is possible:
The file input is the most gnarly of the bunch and requires additional JavaScript if you’d like to hook them up with functional Choose file… and selected file name text.
Actual behavior
I can't see any way in the documentation to do this.
Resources (screenshots, code snippets etc.)
Dawid Wajszczuk staff answered 3 years ago
Hi,
It can't be done due to security reasons. And this is why we don't provide such option. More information can be found in this thread https://stackoverflow.com/questions/1696877/how-to-set-a-value-to-a-file-input-in-html.
Keep coding,
Dawid
phnxdgtl answered 3 years ago
@Dawid Wajszczuk Thanks for the prompt response! I thought that was the case, that's why I was a bit surprised that your documentation suggested it was possible ("...requires additional JavaScript if you’d like to hook them up with functional Choose file… and selected file name text"). Thanks!
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Free
- Premium support: No
- Technology: MDB Standard
- MDB Version: MDB5 3.10.1
- Device: MacBook Pro
- Browser: Chrome
- OS: macOS
- Provided sample code: No
- Provided link: Yes