免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2327 | 回复: 2
打印 上一主题 下一主题

LINUX下文件上传有问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-12-29 23:49 |只看该作者 |倒序浏览
新装的FC5,使用PHP做文件上传,代码在WINDOWS下使用正常,在LINUX下文件没传上来,请各位XDJM帮忙看下,代码如下:

--up.htm--

<form enctype="multipart/form-data" action="up.php" method="post">
<input type="hidden" name="max_file_size" value="3000000">
upfile:<input name="userfile" type="file">
<input type="submit" value="submit">
</form>



--up.php--

<?
$uploaddir='/var/www/uploads/';
$uploadfile=$uploaddir. $_FILES['userfile']['name'];
if(move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile))
{
   print "upload successful!:\n";
   print_r($_FILES);
}
else
{
   print "upload failed!:\n";
   print_r($_FILES);
}
?>


上传文件提示:upload failed!  但error代码为0,也没文件上传,临时目录和上传目录都是空。


php.使用的是LINUX默认安装,没改过任何配置文件
/var/www/uploads/ 和/tmp 都是777权限,属主是root

论坛徽章:
0
2 [报告]
发表于 2007-12-30 16:06 |只看该作者
更该了目录和权限后还是不可以,我使用的是root 用户启动登陆,然后收动启动/etc/init.d/httpd start,以下是详细信息,请各位再帮忙看看,急用:


临时目录权限是:
drwxrwxrwt  8 root root  4096 Dec 30 15:51 tmp

上传目录改为了/var/www/uploads,权限是:
drwxrwxrwx  2 root      root 4096 Dec 29 23:19 uploads

apache的运行权限是:
root      1653     1  0 15:47 ?        00:00:00 /usr/sbin/httpd
apache    1655  1653  0 15:47 ?        00:00:00 /usr/sbin/httpd
apache    1656  1653  0 15:47 ?        00:00:00 /usr/sbin/httpd
apache    1657  1653  0 15:47 ?        00:00:00 /usr/sbin/httpd
apache    1658  1653  0 15:47 ?        00:00:00 /usr/sbin/httpd
apache    1659  1653  0 15:47 ?        00:00:00 /usr/sbin/httpd
apache    1660  1653  0 15:47 ?        00:00:00 /usr/sbin/httpd
apache    1661  1653  0 15:47 ?        00:00:00 /usr/sbin/httpd
apache    1662  1653  0 15:47 ?        00:00:00 /usr/sbin/httpd
root      1727  1690  0 15:53 pts/0    00:00:00 grep httpd  

路径应该没什么问题,我上传文件, 反馈的地址是 /var/www/uploads/21.jpg

论坛徽章:
0
3 [报告]
发表于 2008-01-02 12:00 |只看该作者
php版本是否大于4.0.3?另外move_uploaded_file() 对安全模式和 open_basedir 都是敏感的
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP