in reply to Re: How to check If file exists?
in thread How to check If file exists?

Does your database reside on a different server than your website? If not why have the file path be a URL? Why not a local file path?

And yes one of your issues is the single ticks. You should really always try to bring at least the concantenation character (.) out of any string literal.

if (-e $path.$imagename) {}
or if you really need to quote the variables use:
if (-e "$path"."imagename") {}