PHP batch upload picture of the specific implementation method.

  • 2021-01-06 00:30:05
  • OfStack

We can through the following 1 code, to understand PHP batch upload images of the specific way. When we are learning PHP, we must slowly accumulate experience from practical operation, so as to consolidate what we have learned and gradually strengthen our programming level.

The & # 8226; PHP protects file system specific code sharing
The & # 8226; PHP specific code examples for securing a database
The & # 8226; Explore the main application areas of PHP
The & # 8226; Specific application analysis of AJAX technology based on PHP
The & # 8226; PHP to limit the size of the uploaded file to the specific solution PHP batch upload image code 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 PHP batch upload pictures of all programming, I hope to help students in need.


Related articles: