so I am recording audio on my webpage using recorder.js which records audio from a mic then creates a wav file in javascript. I have this code to create a blob and download the file to the user's computer:
// final binary blob
var blob = new Blob ( [ view ], { type : 'audio/wav' } );
// save file locally
console.log('Handing off the file now...');
var url = (window.URL || window.webkitURL).createObjectURL(blob);
var link = window.document.createElement('a');
link.href = url;
link.download = 'output.wav';
var click = document.createEvent("Event");
click.initEvent("click", true, true);
link.dispatchEvent(click);
I was wondering if there is a way to place this file into an html file upload form input instead of downloading it to the user's computer. I want to do this so that I can easily access the file in my asp.net server side code. Thank you for any help.
No, there is no possibility to initialize
<input type="file">
. This is not implemented in any known browser as it can cause security issues.Imagine an evil developer who makes something like this:
When the clueless user submits the form, the file is going to be uploaded and revealed to the attacker.