CodeIgniter Forums
save image extension as lower case instead of myimage.JPG upper case - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: save image extension as lower case instead of myimage.JPG upper case (/showthread.php?tid=41491)



save image extension as lower case instead of myimage.JPG upper case - El Forum - 05-09-2011

[eluser]coderex[/eluser]
Upload.php in the library saves the extensions in upper case, if the source file is originally saved as uppercase. Is there change I can make in the Upload.php in the standard lib,so it saves it as lowercase? as apache is case sensitive, references to file in lower case are not shown.

I didn't include this code as it's too long.

Thanks


save image extension as lower case instead of myimage.JPG upper case - El Forum - 05-09-2011

[eluser]gullah[/eluser]
You can extend the Upload class set_filename function to use the strtolower function.
Or you can set the filename yourself using this option:

file_name None Desired file name

If set CodeIgniter will rename the uploaded file to this name. The extension provided in the file name must also be an allowed file type.