File selection ID

All Quick 'n Easy Web Builder support issues that are not covered in the forums below.
Post Reply
alex4orly
Posts: 321
Joined: Thu Jul 23, 2020 9:34 am

File selection ID

Post by alex4orly »

I created an upload file page using the built-in QEWB object here : https://nmaa-rc.org.au/uploadpics.html
I wanted to validate what file the user is trying to upload, the element ID of the input / button object is : fileToUpload

But, when trying the following code:
var selected = document.getElementById("fileToUpload");
var thepath = selected.value;
I get an error - undefined. So, I looked through the generated HTML code, and found out the reason - the input field itseld has another ID, this code works fine.... I just wasted a lot of time to figure it out. This can help someone
var selected = document.getElementById("fileToUpload-file");
var thepath = selected.value;
Cheers
Post Reply