Home  >  Article  >  Backend Development  >  Things to note when uploading files in PHP under Linux

Things to note when uploading files in PHP under Linux

WBOY
WBOYOriginal
2016-07-25 08:53:24811browse
  1. chmod -R 777 html
Copy code

Modify a directory to give any user write, read and execute permissions

  1. chmod a+rwx html
Copy code

2. Set the root directory of uploaded files

  1. siteRoot = dirname(__file__); //Get the project root directory
Copy the code

3. Modify the upload size of the configuration file php.ini

  1. post_max_size = 200M
  2. upload_max_filesize = 200M
Copy code

4. If you want to create folders based on time and then upload files, you need

  1. $aimUrl = str_replace('\', '/', $aimUrl);
  2. $aimDir = '';
  3. $arr = explode('/', $aimUrl);
  4. foreach ($arr as $str)
  5. {
  6. $aimDir .= $str . '/';
  7. if (!file_exists($aimDir)) {
  8. mkdir($aimDir);
  9. chmod($aimDir, 0777);
  10. }
  11. }
Copy code


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn