Hi
PHP Code:
<?php
$imgName = "1.jpg";
$stem = strtolower(substr($imgName, 0, strrpos($imgName, ".")));
var_dump($stem);
?>
Result:
So if it's changed into a boolean, at least that's not in the section you posted. Maybe later when you put it in the database?
But another more important thing: It looks to me like you are not filtering input before you use it. What if I upload a picture called "../../../somefile"? Any web user could place files all over your server and overwrite any file the Apache web user can overwrite. Even if you cant upload files with such a filename in most browsers, it doesn't mean it's impossible.
A simple
$imgName = BaseName($imgName);
would fix it.
Another approach would be to not use the filenames the user specifies in the filesystem at all, but use an ID or something instead. You can then simply store the filename in the database if you need it, and if you just need the filename in the filesystem, it will be something like "../upload/$id".
It's a bit safer that way. Don't trust users to provide an extension like ".jpg" to filenames (not all do), and if they do provide an extension, it could be very wrong. And some people use weird unicode characters or questions marks and such in filenames, so you could end up with very strange filenames in the filesystem.