时间:2021-07-01 10:21:17 帮助过:16人阅读
header('Content-Type:text/html;charset=utf-8');$fileArray = $_FILES['file'];//获取多个文件的信息,注意:这里的键名不包含[]$upload_dir = './upload/'; //保存上传文件的目录foreach ( $fileArray['error'] as $key => $error) { if ( $error == UPLOAD_ERR_OK ) { //PHP常量UPLOAD_ERR_OK=0,表示上传没有出错 $temp_name = $fileArray['tmp_name'][$key]; $file_name = $fileArray['name'][$key]; move_uploaded_file($temp_name, $upload_dir.$file_name); echo '上传[文件'.$key.']成功!
'; }else { echo '上传[文件'.$key.']失败!
'; }}
$fileArray = $_FILES['file'] 改为$fileArray = $_FILES['myfile']
感谢小峰峰峡,问题解决了!