为什么程序运行后文件无法上载?

hzh1986 2009-08-08 11:20:01
<?php
if(!$uploadAction):
?>

<html>
<head>
<title>wen jian shang zai jie mian</title>
</head>
<body><table><center>
<form enctype="multipart/form-data"name="submitform"action="" method="post">
<input type="hidden" name="uploadaction" value="1">
<input type="hidden" name="max_file_size" value="10000000">
<tr>
<td><input name="uploadfile" type="file" size="30"></td>
</tr>
<tr>
<td><input name="submit" value="提交" type="submit"></td>
<td><input name="reset" value="重指" type="reset"></td>
</tr>
</form></center></table></body>
</html>

<?php
else:
?>

<html>
<head>
<title>wen jian shang zai dai ma</title>
</head>

<?php
$uploadaction=0;
$timelimit=60;
set_time_limit($timelimit);
$uploaddir='c:/upload';
$uploadfile=$uploaddir.$_files['usefile']['name'];
$timefile=$_files['userfile']['tmp_name'];
$file_size=$_files['userfile']['size'];
$errno=$_files['userfile']['error'];

if(($tmpfile!="none")&&($tmpfile!=""))
{
if($file_size<1024)
{
$strfilesize=(string)$file_size."字节";
}
else if($file_size<(1024*1024))
{
$strfilesize=number_format((double)($file_size/1024),1)."kb";
}
else
{
$strfilesize=number_format((double)($file_size/(1024*1024))."mb";
}

if(!file_exist($uploadfile))
{
if(move_uploaded_file($tmpfile,$uploadfile))
{
echo"文件 $uploadfile($strfilesize)上载成功";
}
else
{
echo"文件 $uploadfile 失败1 (错误好 :$errno)";
}
}
else
{
echo"文件 $uploadfile 已经存在! (错误好:$errno )";
}
}
else
{
echo"没选择文件,或则超过了$max_file_size!";
}
set_time_limit(30);
?>

<br><a herf="nana2.php">返回</a>
</body>
</html>

<?
endif;
?>
...全文
48 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
dahaidao 2009-08-09
  • 打赏
  • 举报
回复
现在没有环境,等有环境了,帮你试一下。
hzh1986 2009-08-08
  • 打赏
  • 举报
回复
就只能运行前面部分,后面不行了呀,为什么呢?
  • 打赏
  • 举报
回复
你确定这段php运行完了?

21,891

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧