这是我在CodeIgniter应用程序中上传文件的代码:
我怎样才能解决这个问题?
function upload_logo(){
$ex=$_FILES['uploadfile']['name'];
$epld=explode('.',$ex);
$filename=date("mdyHis").".".$epld[1];
$userfile_size=$_FILES['uploadfile']['size'];
$imggtype=$_FILES['uploadfile']['type'];
if(move_uploaded_file($_FILES['uploadfile']['tmp_name'],"./uploads/".$filename))
{
echo $filename;
}
}
这里uploadfile
是文件字段的名称。我在根目录中有一个名为uploads的文件夹。当我上传文件时,出现了错误。这在我们的服务器上可以正常工作,但在客户端的服务器上无法正常工作。
A PHP Error was encountered
Severity: Warning
Message: move_uploaded_file(./uploads/112911224341.docx) [function.move-uploaded-file]: failed to open stream: Permission denied
Filename: controllers/pms.php
Line Number: 156
A PHP Error was encountered
Severity: Warning
Message: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpvhzCkw' to './uploads/112911224341.docx'
Filename: controllers/pms.php
Line Number: 156
我怎样才能解决这个问题?