Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/273.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 从webroot文件夹中的webroot外部上载图像_Php_File Upload_Directory Structure - Fatal编程技术网

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()