CodeIgniter Forums
upload lib always returns false - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: Issues (https://forum.codeigniter.com/forumdisplay.php?fid=19)
+--- Thread: upload lib always returns false (/showthread.php?tid=62586)



upload lib always returns false - badger - 08-02-2015

using the upload lib ci v3 with filetypes = gif|png|jpg, files of this type are always rejected because in is_allowed_filetype() it goes through all the checks but the last line returns false. should this not be return true?
bill


RE: upload lib always returns false - ignitedcms - 08-02-2015

Upload works fine for me in 3.0


RE: upload lib always returns false - badger - 08-02-2015

(08-02-2015, 05:08 AM)iamthwee Wrote: Upload works fine for me in 3.0

i'm using 

Code:
$cfg['file_name'] = '0_55be44d03fcdf.png';
$cfg['allowed_types'] = 'gif|jpg|jpeg|png';
$cfg['max_size'] = 0;

$cfg['max_width'] = 0;
$cfg['max_height'] = 0;
$this->upload->initialize($cfg);
$this->upload->do_upload('file');

i trace the is_allowed_filetype() in uploads.php and it goes the whole way from start to finish but the last line in the procedure is "return false" so upload doesnt proceed. if i change this to "return true" upload works fine.


RE: upload lib always returns false - mwhitney - 08-04-2015

If it gets to the last line, that indicates that your mimes config isn't being loaded properly (or maybe you didn't update it from CI2, since CI3's /application/config/mimes.php returns the array, but CI2 just stores the array in the $mimes variable).


RE: upload lib always returns false - badger - 08-04-2015

(08-04-2015, 10:29 AM)mwhitney Wrote: If it gets to the last line, that indicates that your mimes config isn't being loaded properly (or maybe you didn't update it from CI2, since CI3's /application/config/mimes.php returns the array, but CI2 just stores the array in the $mimes variable).

yes, you are 100% correct, very sorry for that stupid oversight.
Many thanks, Bill