Home > php教程 > php手册 > linux下php上传文件注意事项,

linux下php上传文件注意事项,

WBOY
Release: 2016-07-06 14:25:11
Original
793 people have browsed it

linux下php上传文件注意事项,

本文实例为大家分享了linux下php上传文件注意事项,供大家参考,具体内容如下

1、修改上传目录权限
linux 修改某目录下所有所有子目录权限
chmod -R 777 html
修改某目录为任何用户都用写读执行权限
chmod a+rwx html
2、设置上传文件的根目录
//取得项目根目录
$siteRoot = dirname(__file__);
3、修改配置文件的上传大小 php.ini
post_max_size = 200M
upload_max_filesize = 200M
4、如果要根据时间创建文件夹再上传文件则需要如下

$aimUrl = str_replace('', '/', $aimUrl);
$aimDir = '';
$arr = explode('/', $aimUrl);
foreach ($arr as $str) 
{
$aimDir .= $str . '/';
if (!file_exists($aimDir)) {
 mkdir($aimDir);
 chmod($aimDir, 0777);
 }
}
Copy after login

以上就是本文的全部内容,希望对大家学习php程序设计有所帮助。

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template