php method to upload images and replace them: first create "change.html" and "change.php" files; then determine whether the file type is an image format, if so, upload the file and replace the specified file; finally Just call the function that determines the file type and convert it to lowercase.
Recommended: "PHP Video Tutorial"
php implements uploading image files and replaces
First create two files: change.html and change.php
The form code of the change.html file is as follows:
<html> <head> <title>change file example.</title> <meta charset="UTF-8"> </head> <body> <form method="post" action="changefile.php" enctype="multipart/form-data"> <table border=0 cellspacing=0 cellpadding=0 align=center width="100%"> <tr> <td width=55 height=20 align="center"> <input type="hidden" name="MAX_FILE_SIZE" value="2000000" /> 文件: </td> <td> <input name="file" type="file" /> <input type="submit" name="submit" value="submit" /> </td> </tr> </table> </form> </body> </html>
There are several things to pay attention to here. , first look at this sentence