CodeIgniter Forums
Image upload how to force lowercase the file extension?? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Image upload how to force lowercase the file extension?? (/thread-27557.html)



Image upload how to force lowercase the file extension?? - El Forum - 02-14-2010

[eluser]123wesweat[/eluser]
Hi,

I have a working image upload, but i notice that image_3.jpg and image_3.JPG are saved as two different files. How can i prevent this??


Image upload how to force lowercase the file extension?? - El Forum - 02-14-2010

[eluser]kirkaracha[/eluser]
PHP's strtolower function.


Image upload how to force lowercase the file extension?? - El Forum - 02-14-2010

[eluser]123wesweat[/eluser]
yep, i know that one but i can't get it to work.

tried
Code:
$config['file_name'] = strtolower('avatar_'.$user_id);

and

strtolower($upload_data['file_name']);

does something like this exist
Code:
$config["extension_tolower"] = TRUE;



Image upload how to force lowercase the file extension?? - El Forum - 02-14-2010

[eluser]123wesweat[/eluser]
ok found a solution:
Code:
$_FILES[ $field_name ]['name'] = strtolower($_FILES[ $field_name ]['name']);