


QQ group cannot upload files. To upload files, first create a directory and then upload it to the directory.
Jul 29, 2016 am 08:44 AM1. Form part:
Copy the code The code is as follows:
<html>
<head>
<title>
my is upfile app!!
</title>
<meta http-equiv="content-type" c />
</head>
<body>
<form enctype="multipart/form-data" method="post" action="upfile_add.php"> ;
File name: <input type="text" name="title" />
Upload file: <input type="file" name="file" />
<input type="submit" vlaue="Submit" />
</form>
</body>
</html>
2, process the form page:
Copy the code The code is as follows:
< ;?php
$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 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); //Save the file path To the database
}
?>
The above has introduced the problem that the QQ group cannot upload files. To upload files, first create a directory and then upload it to the directory. This includes the content of the QQ group that cannot upload files. I hope it will be helpful to friends who are interested in PHP tutorials.

Hot tools Tags

Hot Article

Hot tools Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

11 Best PHP URL Shortener Scripts (Free and Premium)

Working with Flash Session Data in Laravel

6 Extra Skills Every PHP Developer Should Have

Build a React App With a Laravel Back End: Part 2, React

Simplified HTTP Response Mocking in Laravel Tests

cURL in PHP: How to Use the PHP cURL Extension in REST APIs

12 Best PHP Chat Scripts on CodeCanyon
