<input type="file" name="file1"> <input type="file" name="file2"> <input type="file" name="file3"> <input type="file" name="file4">
Array ( [file1] => Array ( [name] => 8.png [type] => image/png [tmp_name] => G:\wamp\tmp\php737.tmp [error] => 0 [size] => 200 ) [file2] => Array ( [name] => 28.png [type] => image/png [tmp_name] => G:\wamp\tmp\php738.tmp [error] => 0 [size] => 6244 ) [file3] => Array ( [name] => 54a296f8n6787b34c.png [type] => image/png [tmp_name] => G:\wamp\tmp\php739.tmp [error] => 0 [size] => 3143 ) [file4] => Array ( [name] => 54c0573dncb4db6f7.jpg [type] => image/jpeg [tmp_name] => G:\wamp\tmp\php788.tmp [error] => 0 [size] => 5404 ) )
include('./functions.php');
$path = './uploads/'; // 此目录需要手动创建
foreach($file as $v){
$info = uploadFile($v,$path);
⑤判断上传状态
if($info['isok']){
echo '上传成功'.$info['message'];
} else {
echo '上传失败'.$info['message'];
}
}
<input type='file' name="file[]"> <input type='file' name="file[]"> <input type='file' name="file[]">
<input type="file" name="file[]" multiple>
Array ( [userpic] => Array ( [name] => Array ( [0] => 8.png [1] => 9b2d7581fba543ec9bcf95e91018915a.gif [2] => 12.jpg ) [type] => Array ( [0] => image/png [1] => image/gif [2] => image/jpeg ) [tmp_name] => Array ( [0] => G:\wamp\tmp\php85E5.tmp [1] => G:\wamp\tmp\php85E6.tmp [2] => G:\wamp\tmp\php8635.tmp ) [error] => Array ( [0] => 0 [1] => 0 [2] => 0 ) [size] => Array ( [0] => 200 [1] => 16503 [2] => 19443 ) ) )
Array( [name] => 54c0573dncb4db6f7.jpg [type] => image/jpeg [tmp_name] => G:\wamp\tmp\php788.tmp [error] => 0 [size] => 5404 )
foreach($file['name'] as $key=>$value){
$data['name'] = $file['name'][$key];
$data['type'] = $file['type'][$key];
$data['tmp_name'] = $file['tmp_name'][$key];
$data['error'] = $file['error'][$key];
$data['size'] = $file['size'][$key];
$info = uploadFile($data,$path);
if($info['isok']){
echo '上传成功'.$info['message'];
} else {
echo '上传失败'.$info['message'];
}
}
$data['name'] = $file['name'][0]; // 相当于取出了第一个文件的名字 $data['type'] = $file['type'][0]; // 相当于取出了第一个文件的类型
$data = array( [name] => 54c0573dncb4db6f7.jpg [type] => image/jpeg [tmp_name] => G:\wamp\tmp\php788.tmp [error] => 0 [size] => 5404 );
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有