QQ group can not upload files upload files first create a directory and then upload to the directory inside

Source: Internet
Author: User
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.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.