Similar to other libraries, you'll control what is allowed to be upload based on your preferences. In the controller you built above you set the following preferences: $config['upload_path'] = './uploads/'; $config['allowed_types'] = 'gif|jpg|png';
if you want to set bigger upload size to your system, you need to go to php. ini file and change this. upload_max_filesize = 2M; //change this to your desired size.
For Uploading files, as usually we need a Simple HTML form, with an input field and submit button. Here is the Code: 'file','name' => 'userfile')); echo form_submit('submit','upload'); echo form_close(); ?>
I'm sure this is simple but I can't see how to make uploading a file with CI optional.
If you leave the file input box empty, the error "You didn't choose an upload file" appears.
The reason I want it to be optional is that my form edits a directory type listing, and I don't need to upload the image each time I edit the listing.
Is there a way to remove the "required" error handling on the file class
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