still insert data to database with errors when upload images
I have a image, it's size is bigger than $config['assets_upload_max_height'].
If I create a item, then upload the big image, it will show the [size limit error notification].
The ploblem is: the data insert to the database even the error happends.
How can I check this error before save data to database, tried
【
function on_before_save()
{
var_dump($this->get_errors());
exit;
}
】
no errors there.
excuse me for my poor English.
help!!!!!!!!!!
Comments
and in fuel/controllers/module.app line 1453:
[code]
if (!$this->upload->do_upload($file))
{
$errors = TRUE;
add_error($this->upload->display_errors('', ''));
$this->session->set_flashdata('error', $this->upload->display_errors('', ''));
}
[/code]
these codes handle the error "upload_invalid_dimensions"
the flash notification shows and that means I get a error, the "Create" operation should cancel right here,
but data still insert to the database
in fuel/controllers/module.app line 505:
else if ($id = $this->model->save($posted))
line 513:
if (!$this->_process_uploads($posted))
FUEL do create first then do the upload, so nomatter the image valid or not, data already insert into the database
change and move these codes:
// process $_FILES
if (!$this->_process_uploads($posted))
{
$this->session->set_flashdata('error', get_error());
redirect(fuel_uri($this->module_uri.'/create/'));
return false;
}
under:
$this->_run_hook('before_save', $posted);
now it works what i want
not sure that would cause other problems
my name is Kyle
careful with change the framework's source code