I am trying to develop a simple web application using mean stack. I want to take a file input from the user and save the uploaded file into a folder(Ex: /home/user/Desktop/files). Can someone please help me on how to write the controller to do this.
My ui code is as follows.
<h5>Upload file</h5>
<div class="input-group">
<span class="input-group-btn">
<span class="btn btn-primary btn-file">
Browse… <input type="file" multiple>
</span>
</span>
<input type="text" id="file" class="form-control">
</div>
<button type="submit" class="btn btn-primary btn-sm">Submit</button>
It looks like this.
When the user uploads the file. I want the file to appear in the input
field will file
id and when he clicks on the submit
button the file should get saved in the given folder.