我正在尝试检查用户是否选择上传的文件
html
<input type=\"file\" name=\"upload1[]\" multiple />
php
if(is_uploaded_file($_FILES['upload1']['tmp_name'])){
echo 'ok';
}
我正在测试使用它不起作用。有没有其他方法
我会查看此位置以获取有关如何正确处理此案例的更多信息: http ://www.php.net/manual/en/features.file-upload.multiple.php
检查这个
<form enctype="multipart/form-data" method="POST">
Choose a file to upload:
<input type="file" name="upload1[]" multiple />
<br />
<input type="submit" value="Upload File" name="submit" />
</form>
<?php
if (isset($_POST['submit'])) {
if (isset($_FILES['upload1'])) {
$counter = count($_FILES['upload1']['name']);
for ($i = 0; $i < $counter; $i++) {
if (is_uploaded_file($_FILES['upload1']['tmp_name'][$i])) {
echo $_FILES['upload1']['tmp_name'][$i] . ' - ok <br>';
}
}
}
}
?>