盾怪网教程:是一个免费提供流行杀毒软件教程、在线学习分享的学习平台!

文件上传类

时间:2024/11/28作者:未知来源:盾怪网教程人气:

[摘要]使用示例:upload.php<?phpinclude_once "upload.class.php";if (Submit != '') fileA...

使用示例:
upload.php
<?php
include_once "upload.class.php";
if ($Submit != '')
{
    $fileArr['file'] = $file;
    $fileArr['name'] = $file_name;
    $fileArr['size'] = $file_size;
    $fileArr['type'] = $file_type;
    /** 所允许上传的文件类型 */
    $filetypes = array('gif','jpg','jpge','png');
    /** 文件上传目录 */
    $savepath = "/usr/htdocshttp://img3.dunguai.com/upload/technique_8/";
    /** 没有最大限制 0 无限制*/
    $maxsize = 0;
    /** 覆盖 0 不允许  1 允许 */
    $overwrite = 0;
    $upload = new upload($fileArr, $file_name, $savepath, $filetypes, $overwrite, $maxsize);
    if (!$upload->run())
    {
     echo  "上传失败".$upload->errmsg();
    }
}
?>
<html>
<head>
<title>文件上传</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" enctype="multipart/form-data" method="post" action="">
  <input type="file" name="file">
  <input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>

上传类
upload.class.php

<?php
//
// +----------------------------------------------------------------------+
//

关键词:文件上传类




Copyright © 2012-2018 盾怪网教程(http://www.dunguai.com) .All Rights Reserved 网站地图 友情链接

免责声明:本站资源均来自互联网收集 如有侵犯到您利益的地方请及时联系管理删除,敬请见谅!

QQ:1006262270   邮箱:kfyvi376850063@126.com   手机版