I am developing a unity application that runs on a webpage, I want to upload a file to the server, with unity I can call any javascript function that is on the page.. I've hidden (with CSS) a form with a file input, my goal was to simulate a click on this input so that the open file dialog would open..
this is the form:
<form id="upload" method="post" action="upload.php" enctype="multipart/form-data">
<input id="lol" type="file" name="upl" multiple/>
</form>
I tried doing this:
<script type="text/javascript">
function testFunction(){
//$("#lol").trigger('click');
$("#lol").click();
alert("...");
}
</script>
neither worked,
I can see the alert.. but no dialog is opened, shouldn't it work? I dont have much experience with JS or Jquery :(
thank you in advance.
EDIT: corrected the element I want (id=lol), it still does not work