I have the following in my view
<input class="file" name="mpfile[]" type="file" size="32" />
In my controller, i have the following code.
if(isset($_FILES['mpfile'])) {
echo 'testing';
}
Fairly simple yes? .... Except that every time i run it, no matter if i have choosen a file or not, it runs ... Should it only run the echo if i have a file ready for input?
Make sure your FORM element has the following attributes:
method="POST"
and
enctype="multipart/form-data"
check your PHP.ini for:
file_uploads = "1"
post_max_size = 50000
upload_max_file_size = 2M
do a phpinfo();
disclaimer php.ini values might be slightly off, but you'll find them I'm sure. the names are right, not sure if the values are.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With