in reply to How to check If file exists?

Does it find the file if you change:
if ( -e '$path.$imagename')
to:
if ( -e "$path.$imagename")
as single quotes won't interpolate and you are thus looking for a file called: $path.$imagename.

update: upon looking at this further you will probably want to drop the dot inside the quotes, as the dot does not concatenate inside quotes either.

update2: Seems like b10m++ mentioned this below as I was updating.

update3:I missed the fact that you are looking at a url rather than a file... as merlyn's answer below points out...

-enlil

Replies are listed 'Best First'.
Re: Re: How to check If file exists?
by Elijah (Hermit) on Dec 09, 2003 at 21:46 UTC
    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") {}
Re: How to check If file exists?
by b10m (Vicar) on Dec 09, 2003 at 21:44 UTC
    Unless you (OP) have a dot in front of all the filenames (possible,but not likely), you'd probably want to drop the dot.
    if ( -e "$path$imagename")
    Update: As Enlil, I too missed the URL fact...

    --
    B10m