I have a validation function I'm using inside of codeigniter.
function valid_image() {
if ( ($_FILES["file"]["type"] != "image/jpeg") || ($_FILES["file"]["type"] != "image/gif") ) {
$this->form_validation->set_message('valid_image', 'Wrong file type..');
return false;
} else {
return true;
}
With just the "image/jpeg" part in the if statement it works fine. If I try to upload anything other than a jpg file it fails. If I run the code above, it fails with both a jpg or a gif file.
And before someone says "why not use the upload class," I can't. I'm saving my pics directly into MongoDB, so the upload class doesn't help much.