So before I get started, I will let you know that I have read this question and mine is similar. Basically, i need to be able to have the user upload a file from the computer or take a picture from the webcam, put the photo on a canvas and upload that. Is there a way to change the source of a using javascript (I want to change the file source to the to the dataURL)? Here is what I have so far.
In the main html page:
<form name="uploadFile" action="upload.php" method="post" enctype="multipart/form-data" onSubmit="return validate();">
<input type="file" id="imageupload" name="ufile" onKeyPress="return false;">(* jpg,png)
</form>
And in a seperate JS file I have:
button2.addEventListener('click', function(){
imgdata=canvas.toDataURL('image/png');
$("#imageupload").attr("src", imgdata);
});
This code does do what is supposed to (it changes the attribute of #imageupload) but that is how to change the source of the file. Any help would be appreciated!