1
I am creating an application and I need the customer to send in a <form>
a file for the server.
On my HTML page I have two buttons, download and upload, and I would like to have the client select the file to be sent only when clicking the upload button. Example:
document.getElementsByTagName("form")[0].onsubmit = function() {
// Pede para o usuário selecionar o arquivo e depois prossegue
// com a requisição ao servidor.
}
<form action="/upload" method="post" enctype="multipart/form-data">
<input type="file" name="fileUploaded" hidden="true"/>
<input type="submit" value="Enviar arquivo"/>
</form>
The idea is to do the same thing to send a video to youtube. After clicking the button, the user selects the file and the page sends the form. How can I do this with pure Javascript ?
I believe it is not possible to do this without php or js.
– user187043