Modify a directory to give any user write, read and execute permissions
2. Set the root directory of uploaded files
-
- siteRoot = dirname(__file__); //Get the project root directory
Copy the code
3. Modify the upload size of the configuration file php.ini
-
- post_max_size = 200M
- upload_max_filesize = 200M
Copy code
4. If you want to create folders based on time and then upload files, you need
-
- $aimUrl = str_replace('\', '/', $aimUrl);
- $aimDir = '';
- $arr = explode('/', $aimUrl);
- foreach ($arr as $str)
- {
- $aimDir .= $str . '/';
- if (!file_exists($aimDir)) {
- mkdir($aimDir);
- chmod($aimDir, 0777);
- }
- }
Copy code
|