救教php上传问题
大家帮我看看这段代码,它在windows下的appsrv下能执行,可上传到linux下不能执行?我不知是哪里的问题呀?<?php
session_start();
include "conn/conn.php";
$tjname=$_SESSION[username];
$tjzq=$_POST[zq];
$tjzhti=$_POST[zhuti];
$tjuser=$_POST[user];
echo "$tjname <br>";
echo "$tjzq <br>";
echo "$tjzhti <br>";
echo "$tjuser <br>";
$furl=getenv("http_referer");
$time=date("y-m-d h:m:s");
if($zttj){
$uploaddir="./upfiles/";
$type=array("jpg","gif","bmp","jpeg","png","pdf","doc");
function fileext($filename)
{
return substr(strrchr($filename, '.'), 1);
}
function random($length)
{
$hash = 'CR-';
$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
$max = strlen($chars) - 1;
mt_srand((double)microtime() * 1000000);
for($i = 0; $i < $length; $i++)
{
$hash .= $chars[mt_rand(0, $max)];
}
return $hash;
}
$a=strtolower(fileext($_FILES['file3']['name']));
if(!in_array(strtolower(fileext($_FILES['file3']['name'])),$type))
{
$text=implode(",",$type);
echo "您只能上传以下类型文件: ",$text,"<br>";
}
else{
$filename=explode(".",$_FILES['file3']['name']);
do
{
$filename[0]=random(8);
$name=implode(".",$filename);
$uploadfile=$uploaddir.$name;
}
while(file_exists($uploadfile));
if (move_uploaded_file($_FILES['file3']['tmp_name'],$uploadfile)){
$query="insert into tb_zqlb (zq,zhuti,neirong,username,fbsj)values('$tjzq','$tjzhti','$uploadfile','$tjuser','$time')";
$result=mysql_query($query);
if($result==true){
echo "<center>您的文件已经上传完毕 上传图片预览: </center><br><center><img src='$uploadfile'></center>";
echo"<br><center><a href='javascript:history.go(-1)'>继续上传</a></center>";
}
else{
echo "上传失败!";
echo "<meta http-equiv=\"Refresh\" content=\"3;url=fbzt.php\">";}}}}
?>