LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 799|回复: 0

PHP高手帮忙看一下

[复制链接]
发表于 2003-7-21 16:47:35 | 显示全部楼层 |阅读模式
一个上载功能的PHP源文件,看了很久不知那里有错,帮帮忙!!!



<?php
    if(!$UploadAction):
    //判断是上载界面还是实现界面,如果是上载页面,显示下面的HTML页面
?>
<html>
<head>
<title>文件上载界面</title>
</head>
<body>
<table>
<center>
<form enctype="multipart/form-data" name="submitform" action="upload.php" method="OST">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
<inupt type="hidden" name="uploadaction" value="1">
<tr>
        <td><input type="file" name="uploadfile" size="30"></td>
</tr>
<tr>
        <td><input type="submit" name="submit" value="提交"></td>
        <td><input type="reset" name="reset" value="重置"></td>
</tr>
</form>
</center>
</table>
</body>
</html>
<?php
    else:
    //如果是实现页面,显示下面的HTML页面,并激活PHP脚本
?>
<html>
<head>
<title>文件上载代码部分</title>
</head>
<body>
<?php
        $uploadaction=0;
        $timelimit=60;
        set_time_limit($timelimit);
        if(($uploadfile!="none")&&($uploadfile!=""))
        {       
                $uploadpath=AddSlashes(dirname($PATH_TRANSLATED));
                $filename=$uploadpath.$uploadfile_name;       
                if(!file_exists($filename)&&uploadfile_size<$MAX_FILE_SIZE)
                {        if(copy($uploadfile,$filename))
                        echo("文件".$uploadfile_name.$uploadfile_size."上传成功!");
                        else
                        echo("文件".$uploadfile_name."上载失败");
                        unlink($uploadfile);
                }
                else
                {echo("文件".$uploadfile_name."已经存在!");
                }
        else
        {echo("没有选择上载文件!")
        }
        set_time_limit(30);
?>
<br>
<a href="upload.php">继续上载</a>
</body>
</html>
<?
    endif;
?>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表