I have four images to upload. And all these four images are optional in my form.
I tried to make it optional but I could not solve my problem. Please check my code below and let me know any solution for it.
<?php
if(isset($_FILES))
{
if(empty($_FILES['testfile']['name']))
{
echo 'no';
}else{
// do the form validation here
}
}
?>
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="POST" enctype="multipart/form-data">
<input type="file" name="testfile"/>
<input type="submit" value="upload">
</form>
here is some test you can try i hope it helps
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.