What is the equivalent code of move_uploaded_file() function of PHP in javascript?

Suppose that I have an input type which type is “file”

<input type = "file" id = "article_image">

and a button.

<button onclick = "uploadTheImage()">Upload Image</button>

when I click the button, it will go the function uploadTheImage() and move the file inside the input type with an id of article_image to a specific folder like move_uploaded_file() function in PHP did. Meanwhile, after the image has been moved it will going to create an AJAX HTTP request to save the filename of the image to the database. So the question is, how can I moved the uploaded file in a specific folder using a javascript?

Source: php

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.