Home >Backend Development >PHP Tutorial >Introduction to the specific implementation method of batch uploading images in PHP._PHP Tutorial

Introduction to the specific implementation method of batch uploading images in PHP._PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 10:36:45923browse

You can use the following code to learn more about the specific method of batch uploading images in PHP. When we learn PHP, we must slowly accumulate experience from actual operations to consolidate the knowledge we have learned and gradually strengthen our programming skills.

•Sharing specific codes for PHP protection of file systems
•Specific code examples for PHP protection of databases
•Discussing the main PHP application areas
•Specific application analysis of AJAX technology based on PHP
• The specific solution for PHP to limit the size of uploaded files. The code for batch uploading images in PHP is as follows:

Copy the code The code is as follows:

< ;
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);

}
}
}
?>


The above code is all the programming for batch uploading images in PHP. I hope it will be helpful to students in need.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/736852.htmlTechArticleYou can use the following code to learn more about the specific method of batch uploading images in PHP. When we learn PHP, we must slowly accumulate experience from actual operations to consolidate...
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