Home >php教程 >PHP源码 >限制上传的文件大小

限制上传的文件大小

WBOY
WBOYOriginal
2016-06-08 17:27:14992browse
<script>ec(2);</script>

//$limit_size为限制最大文件大小
$limit_size=50000;
$file_size=$HTTP_POST_FILES['ufile']['size'];
if($file_size >= $limit_size) {
echo "你的文件超过的限制的大小
";
echo "你的文件大小为= ".$file_size;
echo " K";
echo "
文件大小限制为= 50000 k";
}
else {
// 上传到什么目录,也就是从临时目录拷贝到目标目录
if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
{
echo "上传成功
";
echo "限制上传的文件大小 ";
}

 

Statement:
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