2013-02-04 105 views
0

我有文件夹结构这样从根目录以外上传图像在根目录的文件夹

public_html 
    /images 

outside 
    /file_uploader.php 

即,public_html是根目录的文件夹。

outside位于webroot文件夹之外。

所以,我想上传文件夹public_html/images

我在文件outside/file_uploader.php这个代码:

move_uploaded_file(
    $_FILES['img_name']['tmp_name'], 
    absolute/path/to/public_html/images/folder 
); 

但这返回错误,那Unable to access to public_html/images文件夹。

问题:如何从outside_of_webroot_file上传文件在webroot\folder

+0

这是文件系统权限的问题。如果你在linux上看看web用户是否有权在文件夹“images”中写入 – Liutas

回答

0
// see if you have permission to write to this folder 
if(!is_writable(absolute/path/to/..)) { 
    chmod() 
} 

move_uploaded_file() 
相关问题