Home > Article > Backend Development > Difference between switch and router Script to establish file exchange function (3)
//do.php executes the uploaded file
When you press the submit button, the file will be uploaded from your computer to the temporary directory of the server.
The file name in the temporary directory is a temporary file. It should be accessed using the name value of the file field, in this case $myfile.
The real file name is accessed using the name value of the file field plus "_name", in this case $myfile_name.
Use the copy() function to copy the temporary file $myfile to the specified directory. The copied file name is $myfile_name.
Don’t forget to delete the temporary files when finished, otherwise you will have a lot of files you don’t want.
In addition, you must have read and write permissions on the directory you specify. Here it is /usr/local/apache/htdocs/file/