GetSimple Support Forum
QUESTION Add strtolower for file-extension in upload.php - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Feature Requests (http://get-simple.info/forums/forumdisplay.php?fid=7)
+--- Thread: QUESTION Add strtolower for file-extension in upload.php (/showthread.php?tid=9973)



Add strtolower for file-extension in upload.php - Shasaar - 2017-09-01

Hello,

due to my problem with the Imagizer Plugin, that it doesn't recognize files with an extension in uppercase letter, like pic.JPG, I added the following to upload.php, which finally (woohoo) sorted out the problem:

line 52: $extension = strtolower($extension);

Would it be possible or a good idea to add that to future versions of GetSimple, just to prevent similar problems or is it for any extension important to be saved in GS with case-sensitive?

Just asking, cause it really gave me trouble and finding the solution was really searching for a needle in a haystack.
Thank you in advance.
Cheers.
Shasaar


RE: Add strtolower for file-extension in upload.php - datiswous - 2017-09-04

Isn't it possible to include this in the Imagizer Plugin, since (assuming) the problem only applies to that plugin?


RE: Add strtolower for file-extension in upload.php - Shasaar - 2017-09-06

Hello datiswous,

thank you for your message.
Unfortunately, I couldn't fix the problem just by changing the code in Imagizer or maybe I just didn't find the right line?

Cheers.
Shasaar


RE: Add strtolower for file-extension in upload.php - datiswous - 2017-09-06

Ok, but you could ask the plugin creator..


RE: Add strtolower for file-extension in upload.php - hameau - 2017-09-10

(2017-09-04, 04:50:12)datiswous Wrote: Isn't it possible to include this in the Imagizer Plugin, since (assuming) the problem only applies to that plugin?

It's difficult (for me, anyway ...) because there is already a conversion to lowercase by the GS native upload, but it only changes the filename, not the extension. However, the file information exported from the GS upload has the filename (and extension) in the same case as the file that was transferred.

Thus, if I upload a filename such as IMG_1000.JPG (quite common from a camera), the GS upload saves a file named img_1000.JPG, but it reports the filename as 'IMG_1000.JPG'.

This means that there has to be much more manipulation of the reported filename to allow further processing in order to avoid errors ('No such file or directory ...').

It would be much more consistent if GS changed the complete filename, including the extension.


RE: Add strtolower for file-extension in upload.php - shawn_a - 2017-09-10

interesting, ill check into it, if we are normalizing filename we should be normalizing extensions also, so i agree
feel free to open an issue on github


RE: Add strtolower for file-extension in upload.php - hameau - 2017-09-10

(2017-09-10, 22:42:45)shawn_a Wrote: ... feel free to open an issue on github

Thanks, Shawn: https://github.com/GetSimpleCMS/GetSimpleCMS/issues/1236

In fact, the extension isn't cleaned at all and can contain any of the forbidden characters.  Exclamation