php 文件上传系统手记_PHP

WBOY
Release: 2016-06-01 12:23:04
Original
827 people have browsed it

整个系统只有带码全部用PHP,没有JS,没有正则...纯纯的PHP...其实别的我也不会呵呵...
下面是原表单的html带码...
上传文件表单
复制代码 代码如下:



Map Name:




File Path:









表单中enctype="multipart/form-data"的意思,是设置表单的MIME编码。默认情况,这个编码格式是 application/x-www-form-urlencoded,不能用于文件上传;只有使用了multipart/form-data,才能完整的传递文件数据,进行下面的操作.enctype="multipart/form-data"是上传二进制数据; form里面的值以2进制流的方式传过去。
这句好像是没有用的...我原以为这个可以限制上传文件大小呢,上传文件大小只有在php.ini里或后面上传的文件的脚本里设置了...我程序里是直接设置php.ini中upload_max_filesize=6M的.
下面是上传程序
Code
复制代码 代码如下:
$uploaddir="./map/";
$typearr=array("rar","zip","w3m","w3x");
$findstr=array("/","\\"," ",""); //对名称进行过滤
$mapname=str_replace($findstr,'',($_POST['mapname']));
//取扩展名
function upfiletype($filename){
$arr=explode('.',$filename);
$a=count($arr)-1;
return $arr[$a];
}
//字符串是不是纯数字
function isNo($str){
$intarr=array('1','2','3','4','5','6','7','8','9','0','.');
$a=str_replace($intarr,'',$str);
return ($a=="")?1:0;
}
//////控制窗口大小///////
function html(){
echo
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template