Good day. I am working with C# and ASP.Net on the server side and with JS and html on the client side.
I have a form similar to this
<form id='frmForm'>
<label>Subir Archivo</label>
<input type ='file' id='file' />
<button>Guardar</button>
</form>
What I want is to obtain the file through js and send it to my server through AJAX as one more parameter, since in reality I send several more fields.
If you could guide me on how to do this function, both on the client side and as what type of data I receive from the server side
Cheers
First there are several things you need to do on the server: 1. Define a file type control like this 2. You need to create a button that calls a JavaScript function that takes care of selecting the file and calling the Ajax function. Try it 3. You must define the JavaScript function, something like this: function LoadFile() { var x = document.getElementById("myFile"); } 4. In the function you must define the Ajax that communicates with the function on the server.
For example: On the client it can be something like this:
On the server it can be something like this: