views:

68

answers:

1

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

thanks

A: 

Use the following:

<?php if ( $_FILES AND $_FILES['field_name']['name'] ) 
{
    // Upload the file
}
Yorick Peterse