How to Write the PHP
The PHP for handling the file upload is a very small and simple script. (Note that no security is added to the script; I’m leaving that part to you.) The method that we use to move the file to a specific location on the server is move_uploaded_file. This method takes two parameters: a string filename representing the selected file, and a string destination representing the server location where we want the file to be uploaded.
The second line of code handles setting the correct permissions for UNIX and Linux servers. In this example, we set full permission for the uploaded file.