- 论坛徽章:
- 0
|
ftp上传问题!不能上传为什么?
上传了没反映!
是却为什么文件?
还是什么代码有问题
index.html文件:
<html>
<head>
<title>文件上传系统
</title>
</head>
<body>
<table>
<center>
<br>
<h1>请上传文件</h1>
<br>
<form ENCTYPE="multipart/form-data" NAME="SubmitForm" ACTION="upload.php" METHOD="POST">
<INPUT TYPE="hidden" NAME="MAX_FILE_SIZE" VALUE="1000000">
<TR>
<td><INPUT NAME="UploadFlie" 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>
upload.php文件:
<?
//// upload.php
if(!$UploadeAction):
?>
<html>
<head>
<title>文件上传系统
</title>
</head>
<body>
<table>
<center>
<br>
<h1>请上传文件</h1>
<br>
<form ENCTYPE="multipart/form-data" NAME="SubmitForm" ACTION="upload.php" METHOD="POST">
<INPUT TYPE="hidden" NAME="MAX_FILE_SIZE" VALUE="1000000">
<TR>
<td><INPUT NAME="UploadFlie" 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>文件上传代码</title>
</head>
<body>
<?php
$UploadAction=0;
$TimeLimit=60;
set_time_limit($TimeLimit);
If(($UploadFile !="none")&&($UploadFile !=""))
{$UploadPath=AddSlashes(dirname($PATH_TRANSLATED))."/upload/";
$FileName =$UploadPath.$UploadFile_name;
if($UploadFile_size<1024)
{
$FileSize=(string)$UploadFile_size." 字节";
}
elseif($UploadFile_size<(1024*1024))
{
$FileSize = number_format((double)($UploadFile_size/1024),1)."KB";
}
else
{
$FileSize = number_format((double)($UploadFile_size/1024),1)."MB";
}
if(!file_exists($FileName))
{
if(copy($UploadFile,$FileName))
{
echo "文件 $UploadFile_name($FileSize)上载成功!";
}
else
{
echo "文件 $UploadeFile_name 上载失败!";
}
unlink($UploadFile);
}
else
{
echo "文件 $UploadFile_name 已经存在!";
}
}
else
{
echo "你没有选择上载文件!";
}
set_time_limit(30);
?>
<br>
<a href="upload.php">返回</a>
</body>
</html>
<?php
endif;
?>
[ 本帖最后由 vertrigo 于 2007-12-19 11:36 编辑 ] |
|