Home >Backend Development >PHP Tutorial >PHP dynamic multiple file upload_PHP tutorial

PHP dynamic multiple file upload_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:48:05921browse

文件上传代码
view plaincopy to clipboardprint?




文档上传







" />



文件上传列表









文档上传







" />



文件上传列表





提交文件代码
view plaincopy to clipboardprint?




文件上传结果


if ($_POST["submitfile"]!="")
{
$Path="./".date('Ym')."/";
if (!is_dir($Path))//创建路径
{ mkdir($Path); }
echo "
";
for ($i=0;$i{ //$_FILES["filelist"]["size" The order of ][$i] cannot be changed, because fileist is a two-dimensional array
if ($_FILES["filelist"]["size"][$i]!=0)
{
$File=$Path.date('Ymdhm')."_".$_FILES["filelist"]["name"][$i];
if (move_uploaded_file($_FILES["filelist"][ "tmp_name"][$i],$File))
{ echo "File uploaded successfully. File type:".$_FILES["filelist"]["type"][$i]." "."File name :"
.$_FILES["filelist"]["name"][$i]."
"; }
else
{ echo "File name:".$_FILES[" filelist"]["name"][$i]."Upload failed
"; }
}
}
echo "

Return
";
}
?>


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/319812.htmlTechArticleFile upload code view plaincopy to clipboardprint? !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional/ /EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" html xml...
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
Previous article:php zend relative path problem_PHP tutorialNext article:php zend relative path problem_PHP tutorial

Related articles

See more