Heim  >  Artikel  >  Backend-Entwicklung  >  linux下php上传文件注意事项

linux下php上传文件注意事项

WBOY
WBOYOriginal
2016-07-25 08:53:24811Durchsuche
  1. chmod -R 777 html
复制代码

修改某目录为任何用户都用写读执行权限

  1. chmod a+rwx html
复制代码

2、设置上传文件的根目录

  1. siteRoot = dirname(__file__); //取得项目根目录
复制代码

3、修改配置文件的上传大小 php.ini

  1. post_max_size = 200M
  2. upload_max_filesize = 200M
复制代码

4、如果要根据时间创建文件夹再上传文件则需

  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. }
复制代码


Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn