29 lines
685 B
PHP
29 lines
685 B
PHP
<?php
|
|
/*
|
|
* 支持上传多个文件
|
|
* 如果你遇到了上传失败的问题
|
|
* 请检查PHP的post_max_size、upload_max_filesize属性值
|
|
*/
|
|
if (!is_dir("./upload")) {
|
|
mkdir("./upload");
|
|
}
|
|
print_r($_FILES);
|
|
echo '<br>';
|
|
$file_array = array_unique($_FILES["file"]["name"]);
|
|
print_r($file_array);
|
|
$result = true;
|
|
foreach ($file_array as $key => $value) {
|
|
if($value){
|
|
$path = "upload/".$value;
|
|
if(!move_uploaded_file($_FILES["file"]["tmp_name"][$key],$path)){
|
|
$result = false;
|
|
}
|
|
}
|
|
}
|
|
if($result){
|
|
echo "文件上传成功";
|
|
}else{
|
|
echo "文件上传失败";
|
|
}
|
|
echo '<meta http-equiv="refresh" content="3; url = 7.test3.php">';
|