PHP批量上传图片的具体实现方法介绍.

yipeiwu_com7年前PHP代码库

大家可以通过下面这一段代码,来具体了解PHP批量上传图片的具体方式。我们在学习PHP的时候,肯定是要从实际操作中慢慢积累经验,以巩固我们所学到的知识,逐渐的加强我们的编程水平。

•PHP保护文件系统的具体代码分享
•PHP保护数据库的具体代码示例
•探讨主要的PHP应用领域
•基于PHP的AJAX技术的具体应用解析
•PHP限制上传文件大小的具体解决办法PHP批量上传图片的代码如下:

复制代码 代码如下:

<
html
>

<
head
>
<
title
>
uploadpicturemoreonce
</
title
>
</
head
>

<
body
>

<
form

action=
""
method=
"post"
enctype=
"multipart/form-data">

<

>
Pictures:
<
br

/>

<
input

type=
"file"
name=
"pictures[]"
/>
<
br

/>

<
input

type=
"file"
name=
"pictures[]"
/>
<
br

/>

<
input

type=
"file"
name=
"pictures[]"
/>
<
br

/>

<
input

type=
"submit"
name=
"upload"
value=
"Send"
/>

</

>

</
form
>

</
body
>

</
html
>

<?
php

if($_POST['upload']=='Send'){

$dest_folder=
"picture/";18.if(!file_exists($dest_folder)){19.mkdir($dest_folder);

}

foreach($_FILES["pictures"]["error"]as$
key=
>
$error){

if($
error==UPLOAD_ERR_OK){

$tmp_name=$_FILES["pictures"]["tmp_name"][$key];

$name=$_FILES["pictures"]["name"][$key];

$uploadfile=$dest_folder.$name;26.move_uploaded_file($tmp_name,$uploadfile);

}
}
}
?>


以上代码就是PHP批量上传图片的全部编程,希望对有需要的同学有所帮助。

相关文章

php常用Stream函数集介绍

stream_bucket_append函数:为队列添加数据 stream_bucket_make_writeable函数:从操作的队列中返回一个数据对象stream_bucket_ne...

php使用strpos判断字符串中数字类型子字符串出错的解决方法 原创

本文实例讲述了php使用strpos判断字符串中数字类型子字符串出错的解决方法。分享给大家供大家参考,具体如下: 一、问题: 最近的开发中在程序代码里有一个随机数是否在给定字符串里的判断...

php输出echo、print、print_r、printf、sprintf、var_dump的区别比较

用.net开发已经5年了,最近突然想接触一下。net以外的东西,于是乎就来看看php了。在学习php中首先看看几个输出函数。一、echoecho() 实际上不是一个函数,是php语句,因...

php中opendir函数用法实例

本文实例分析了php中opendir函数用法。分享给大家供大家参考。具体如下: opendir语法:opendir(path,context) 目录,功能说明:打开目录句柄,opendi...

php使用数组填充下拉列表框的方法

本文实例讲述了php使用数组填充下拉列表框的方法。分享给大家供大家参考。具体实现方法如下: <?php $data = array( (object)array("...