上传图片时出错

时间:2014-11-05 10:23:36

标签: php image file upload syntax-error

faultCode1faultStringWarning:move_uploaded_file(../infos/upload/photo_1-immo65luz-1415182268.png) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/eq8115/eq79237/html/application_v2/index.php on line 75faultCode1faultStringWarning:move_uploaded_file() [function.move-uploaded-file]: Unable to move '/home/tmp/phpMTDMSQ' to '../infos/upload/photo_1-immo65luz-1415182268.png' in /home/eq8115/eq79237/html/application_v2/index.php on line 75modif

当我尝试在管理面板中添加照片时,会出现上述错误。

这是用于上传的代码的一部分:

foreach ($_FILES as $k=>$photo){

                //---- changement de nom

                $nom_file = str_replace(".","_",$photo['name']);

                $t_nom = split("_",$nom_file);

                $ext = $t_nom[count($t_nom)-1];

                $nom = "upload/".$k."-".$_SESSION['admin']."-".time().".".$ext;

                if (move_uploaded_file($_FILES[$k]['tmp_name'],"../infos/$nom"))

                {

                    $_POST[$k] = $nom;

                }

            }

任何人都可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

您的错误字符串已经表明您的目录没有写入权限。

如果没有,请检查目录的用户权限然后您必须将其设置为755权限