First on the source code, you can copy to your own computer up to run ~
Copy CodeThe code is as follows:
<title>Multiple file uploads</title>
Uploading file information
$img = $_files[' img '];
if ($img)
{
File storage directory, and this PHP file sibling
$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 the upload is successful, preview
if ($state)
{
echo "";
}
}
$i + +;
}
}
?>
Move_uploaded_file () function
The Move_uploaded_file () function moves the uploaded file to a new location. Returns true if successful, otherwise false is returned.
Usage: move_uploaded_file (file,newloc)
Parameter file, required. Specifies the files to be moved.
Parameter newloc, required. Specify a new location for the document.
This function checks and ensures that files specified by file are valid upload files (that is, uploaded via PHP's HTTP POST upload mechanism). If the file is valid, move it to the file specified by Newloc.
If file is not legitimately uploaded, no action will occur and Move_uploaded_file () will return false.
If file is a legitimate upload, but for some reason it cannot be moved, nothing happens, Move_uploaded_file () returns false, and a warning is issued.
This check is especially important if the uploaded file is likely to cause the user or other users of the system to display its content.
Note: This function is only used for files uploaded via HTTP POST.
Note: If the destination file already exists, it will be overwritten.
http://www.bkjia.com/PHPjc/323970.html www.bkjia.com true http://www.bkjia.com/PHPjc/323970.html techarticle first on the source code, you can copy to your own computer to run ~ Copy code code as follows: HTML meta http-equiv= "Content-type" content= "text/html; Charset=utf-8" head Title Multiple Files ...