Search code examples
javascriptjavascript-objects

I want Javascript which gets the file input and save it to local path


I want Javascript which gets the file input and save it to local path

<input type="file" name="attachment1" id="attachment1" style="width:500;">

<script>

//Javascript--variable to assign the above file and its name
//Then save it to local path(some where in C drive)

</script>

Solution

  • JavaScript is a language that, usually, runs on your local machine. Therefore you are sending a potential thread to the pc your code runs on, every time you send that pc some JavaScript.

    In order to prevent abuse, computers are protected from doing harmfull stuff like automatically download virusses and store them somewhere on your C drive.

    If you want to save it on the server however, have a look into Node.js.