Home  >  Article  >  Backend Development  >  PHP batch upload implementation code_PHP tutorial

PHP batch upload implementation code_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:07:38758browse

As shown below:

Copy code The code is as follows:

if (isset($_POST['submit'])) {
foreach($_FILES['product_img']['error'] as $k=>$v){
if ($v == UPLOAD_ERR_OK) {
$sql ='product_img'.( $k+1);
$tmp_name = $_FILES['product_img']['tmp_name'][$k];
$file_name = $_FILES['product_img']['name'][$k ];
$file_type = $_FILES['product_img']['type'][$k];
$upload_name = getPath('../Public/Upload').time().'_' .$file_name;
@move_uploaded_file($tmp_name,$upload_name);
$map[$sql] = $file_name;
print_r($map);
exit;
}
}
}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327522.htmlTechArticle is as follows: Copy the code as follows: if (isset($_POST['submit'])) { foreach ($_FILES['product_img']['error'] as $k=$v){ if ($v == UPLOAD_ERR_OK) { $sql ='product_img'.($k+1); $...
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