Home > php教程 > php手册 > 多图片上传的php代码

多图片上传的php代码

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 10:03:44
Original
1160 people have browsed it

提供一个基础教程了,告诉你如果利用move_uploaded_file函数来实现多图片上传了,当然也可以实现多文件上传操作了,希望对你有帮助。

提供一个基础教程了,告诉你如果利用move_uploaded_file函数来实现多图片上传了,当然也可以实现多文件上传操作了,希望对你有帮助。




多文件上传


















//上传文件信息
$img = $_FILES['img'];
if ($img)
{
//文件存放目录,和本php文件同级
$dir = dirname(__file__);
$i = 0;
foreach ($img['tmp_name'] as $value)
{
$filename = $img['name'][$i];
if ($value)
{
$savepath="$dir$filename";
$state = move_uploaded_file($value, $savepath);
//如果上传成功,预览
if($state)
{
echo "$filename ";
}
}
$i++;
}
}
?>

Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template