1. Form part:
Copy code The code is as follows:
2. Process the form Page:
Copy code The code is as follows:
$mkdir_file_dir = mkdir(' ./img/'.$_POST['title'],0777); //Get the title and create a folder under the final directory to store the files specified by the category
$tmp_file_name = $_FILES['file ']['tmp_name']; //Get the uploaded temporary file
$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 the file to the final saving 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); // Store the file path in the database
}
?>
http://www.bkjia.com/PHPjc/322762.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/322762.htmlTechArticle1, form part: Copy the code as follows: html head title my is upfile app!! /title meta http- equiv="content-type" content="text/html;charset=utf-8" / /head body form enctype="...