单文件上传前台
<form action="up.php" method="post" enctype="multipart/form-data" > <input type="file" name="file" id="file"><br> <input type="submit" name="submit" value="提交"> </form>
多文件上传
<form action="up.php" method="post" enctype="multipart/form-data" > <input type="file" name="file[]" id="file" multiple="multiplt"><br> <input type="submit" name="submit" value="提交"> </form>
后台接受:$_FILES ($_POST这些是接受不到的)
array(1) {
["file"] => array(5) {
["name"] => array(2) {
[0] => string(27) "360截图16501005896885.png"
[1] => string(28) "360截图164001195710387.png"
}
["type"] => array(2) {
[0] => string(9) "image/png"
[1] => string(9) "image/png"
}
["tmp_name"] => array(2) {
[0] => string(53) "C:UsersAdministratorAppDataLocalTempphp3671.tmp"
[1] => string(53) "C:UsersAdministratorAppDataLocalTempphp3682.tmp"
}
["error"] => array(2) {
[0] => int(0)
[1] => int(0)
}
["size"] => array(2) {
[0] => int(69926)
[1] => int(39556)
}
}
}
or
<form action="{:url('upload1')}" method="post" enctype="multipart/form-data" > <input type="file" name="file[]" id="file"><br> <input type="file" name="file[]" id="file"><br> <input type="file" name="file[]" id="file"><br> <input type="submit" name="submit" value="提交"> </form>