1, form section:
Copy the Code code as follows:
<br>my is Upfile app!! <BR>
2, Process the form page:
Copy the Code code as follows:
$mkdir _file_dir = mkdir ('./img/'. $_post[' title '],0777); Get to the title, create a folder underneath the final directory to hold the file specified by the category
$tmp _file_name = $_files[' file ' [' Tmp_name ']; Get a temporary file after uploading
$file _name = $_files[' file ' [' Name ']; source file
$file _dir = './img/'. $_post[' title ']. ' /'; Final Save Directory
if (Is_dir ($file _dir))
{
Move_uploaded_file ($tmp _file_name, $file _dir. $file _name); Move files to the final save directory
$img _url = $file _dir. $file _name;
$link = mysql_connect ("localhost", "root", "");
mysql_select_db ("Fenye");
mysql_query ("Set names UTF8");
$insert = "INSERT into Upfiles (Title,img_url) VALUES (' {$_post[' title '} ', ' {$img _url} ')";
mysql_query ($insert); Storing the file path in the database
}
?>
The above describes the QQ group can not upload files to upload files to create a directory before uploading to the directory, including the QQ group can not upload the contents of the file, I hope that the PHP tutorial interested friends have helped.