Php 从webroot文件夹中的webroot外部上载图像
我有这样的文件夹结构Php 从webroot文件夹中的webroot外部上载图像,php,file-upload,directory-structure,Php,File Upload,Directory Structure,我有这样的文件夹结构 public_html /images outside /file_uploader.php 也就是说,public\u html是webroot文件夹 外部位于webroot文件夹外部 所以,我想上传文件夹public\u html/images中的文件 我在文件out/file\u uploader.php中有以下代码: move_uploaded_file( $_FILES['img_name']['tmp_name'],
public_html
/images
outside
/file_uploader.php
也就是说,public\u html
是webroot文件夹
外部
位于webroot文件夹外部
所以,我想上传文件夹public\u html/images
中的文件
我在文件out/file\u uploader.php中有以下代码:
move_uploaded_file(
$_FILES['img_name']['tmp_name'],
absolute/path/to/public_html/images/folder
);
但这会返回一个错误,无法访问public\u html/images
文件夹
问题:如何在webroot\folder
中的webroot\u文件
的外部上传文件?这是文件系统权限的问题。如果您使用linux,请查看web用户是否有权在文件夹“images”中写入
// see if you have permission to write to this folder
if(!is_writable(absolute/path/to/..)) {
chmod()
}
move_uploaded_file()