当前位置:编程学习 > php >>

php 上传文件问题

$err_msg = ""; //初始化错误信息
$max_upload_filesize = 1 * 1024 *1024; //设置最大尺寸 (单位: 字节), 这里是 1MB
$arr_allowed_filetype = @array('application/x-shockwave-flash'); //设置允许文件类型
@$_FILES['game']['size'] > $max_upload_filesize and $err_msg .= "<script> alert('您上传的文件超出范围!!');this.location.href='addfun.php?user=$user'; </script>";
in_array($_FILES['game']['type'], $arr_allowed_filetype) or $err_msg .= "<script> alert('您上传的类型错误!!');this.location.href='addfun.php?user=$user'; </script>";
$err_msg and exit($err_msg);
$path = 'fun/'.$_FILES['game']['name'];
move_uploaded_file($_FILES['game']['tmp_name'],$path);

现在时flash上传格式

怎么限制他上传MP3格式的

追问:$arr_allowed_filetype = @array('application/x-shockwave-flash');

能弄这类的代码限制吗?'application/x-shockwave-flash'把这个换掉

换成什么 这样可以限制不?

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,