Posted by mark babli on 07/14/06 23:27
I just want to agree with Frankie on "going one step at a time" when
building any path on any file system. Moreover, simple echos to those
variable often save you lots of frustration. I was working on something
similar and had a heck of a time until I realized that the path isn't being
built right.
"Krustov" <me@privacy.net> wrote in message
news:MPG.1f21bdb8fd6cf7f9989bea@news.newsreader.com...
> <comp.lang.php>
> <Frankie>
> <Fri, 14 Jul 2006 02:53:51 GMT>
> <3HDtg.7339$ye3.7309@newsread1.news.pas.earthlink.net>
>
>> However, I need to use variables in this code.
>>
>> Specifically, I'm trying to do something like this:
>>
>> $pass=0;
>> $filename="../{$_POST['hfCategory']}/photos/{$_POST['hfItemNumber']}.jpg";
>> if (!file_exists($filename)) {$pass=1;}
>>
>> if ($pass==1) {unlink($filename);}
>>
>> ..but it's not working.
>>
>> Any additional advice appreciated.
>>
>
> I'd start by breaking it down a little .
>
> $temp1="$_POST['hfCategory']";
> print "temp1 = $temp1 <br>";
>
> $temp2="$_POST['hfItemNumber']";
> print "temp2 = $temp2 <br>";
>
> $filename="$temp1/photos/$temp2" . ".jpg";
>
> Making sure you have the path 100% correct is the first step .
>
> TMK "../" doesnt need to be used unless you have good reason to do so .
>
>
> --
> Encrypted email address
> www.emailuser.co.uk/?name=KRUSTOV
[Back to original message]
|