用php上传多个文件,需要对许多可能的错误检查。此脚本允许上载有多少领域设置将在html表格中显示的最大允许上传文件大小。在php.ini文件中还包含一个名为ini选项中upload_max_filesize拥有2米的默认值,或2兆字节。此值也考虑到检查时的错误。
这些错误是存储在数组中的信息,并要求每个文件上传信息的基础上产生的任何错误或上载成功。的形式本身就是验证,按照在doctype w3c验证器。
$upload_max)
{
$messages[] = file size exceeds $upload_max php.ini limit;
}
// check the file is less than the maximum file size
elseif($_files['userfile']['size'][$i] > $max_file_size)
{
$messages[] = file size exceeds $max_file_size limit;
}
else
{
// copy the file to the specified dir
if(@copy($_files['userfile']['tmp_name'][$i],$upload_dir.'/'.$_files['userfile']['name'][$i]))
{
/*** give praise and thanks to the php gods ***/
$messages[] = $_files['userfile']['name'][$i].' uploaded';
}
else
{
/*** an error message ***/
$messages[] = 'uploading '.$_files['userfile']['name'][$i].' failed';
}
}
}
}
?>
br /> http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd>
multiple file upload
http://www.bkjia.com/phpjc/444986.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/444986.htmltecharticlephp 多文件上传 用php上传多个文件,需要对许多可能的错误检查。此脚本允许上载有多少领域设置将在html表格中显示的最大允许上传文件大...
