Hi,
I tried that option but it didnt work - I checked that grocery_crud_file_upload_allow_file_types had my modified content - and it did - but the upload still allowed text and other files.
Here's what I tried:
function _init_upload_params(){
$this->config->grocery_crud_file_upload_allow_file_types = 'gif|jpeg|jpg|png|tiff';
$this->config->grocery_crud_file_upload_max_file_size = '20MB'; //ex. '10MB' (Mega Bytes), '1067KB' (Kilo Bytes), '5000B' (Bytes)
}
and I would l\call that prior to $crud = new grocery_CRUD();
I ended up using this little trick - according to http://www.iana.org/assignments/media-types all image types begin with "image/xyz"
here's the callback code:
public function _cb_valid_images($files,$field_info) {
$vtypes = $this->config->grocery_crud_file_upload_allow_file_types;
$mtype = $files[$field_info->encrypted_field_name]['type'];
$errorstr ="Sorry - Only Image files allowed ($vtypes)";
if ( stripos($mtype,'image') !== False ) {
if (stripos($vtypes,substr($mtype,6)) === False) {
return $errorstr;
}
} else {
return $errorstr;
}
}
Hope this helps someone..
Cheers
EZ