Multiple file uploads (php+js can dynamically add file upload boxes)
Multiple file uploads (php tutorial+webpage special effects can dynamically add file upload boxes)
< ;title>Multiple file uploads (php+webpage special effects can dynamically add file upload boxes)
if($_post['sub'])
{
$ftype=array ('image/jpg','image /jpeg','imgage/png','image/pjpeg','image/gif');//File types allowed to be uploaded
$files=$_files['files '];
$fnum=count($files['name']); //Get the number of uploaded files
for($i=0;$i<$fnum;$i++)
{
if($files['name'][$i]!=''&&is_uploaded_file($files['tmp_name'][$i]))
{
if(in_array($files[' type'][$i],$ftype))//Determine whether the file is an allowed type
{
$fname='upfile/'.rand(0,10000).time().substr($ files['name'] [$i],strrpos($files['name'][$i],'.'));//Automatic naming
move_uploaded_file($files['tmp_name'][$i ],$fname);
echo '
File uploaded successfully! ';
}
else
{
echo '
Unallowed file type! ';
}
}
else
{
echo '
The file does not exist! ';
}
}
}
?>
Upload another one
http://www.bkjia.com/PHPjc/444888.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/444888.htmlTechArticleMultiple file uploads (php+js can dynamically add file upload boxes) Multiple file uploads (php tutorial + web page Special effects can dynamically add file upload boxes) !doctype html public -//w3c//dtd xhtml 1.0 transiti...
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