[英]unable to make image upload optional in codeigniter
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 这是一些测试,您可以尝试,希望对您有所帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.