Re: Using File_exists?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 6/3/09 1:41 PM, "Eddie Drapkin" <oorza2k5@xxxxxxxxx> wrote:

just initially, and this might be a typo but

$FilePath =
"http://localhost:8888/HarrisAutomate/output/WebImagesHiRes/$ImageName";;

//$BackupPath =
"http://localhost:8888/HarrisAutomate/WebImagesHiRes/output/backup/";;

$FilePath has an /output/ that $BackupPath doesn't.

Also, make sure you don't have safe_mode or open_basedir restricting the files php can see, although I'm reasonably sure the fact that it's an URL should nullify that.  Also, make sure you have allow_url_fopen turned on.

On Wed, Jun 3, 2009 at 2:31 PM, Miller, Terion <tmiller@xxxxxxxxxxxxxxxxxxxx> wrote:
I wrote this little script (part of a much much larger one I am working at)
anyways, I am trying to get it to compare a file name from a db to an actual
file in a folder and then tell me if it does or doesn't exist, the problem I
have is that the files do exist, I echo them out, but it says file does not
exist right after that it echos the file for me.... What do I have wrong?

     $FileName = $row['Image'];


      $ImageName = $row['Image'];


      $ImageName = str_replace("/", "", $ImageName);


$FilePath =
"http://localhost:8888/HarrisAutomate/output/WebImagesHiRes/$ImageName";;

//$BackupPath =
"http://localhost:8888/HarrisAutomate/WebImagesHiRes/output/backup/";;




if (file_exists($FilePath))  {

echo "The file $ImageName exists";
}
else {
    echo "The file $ImageName does not exist"  . '<br />';
}





     $FileName = str_replace("/", "", $FileName);

  $FileName = str_replace(".jpg", "", $FileName);






echo ($FileName) . '<br />';

echo '<img src="' . $FilePath .'">' . '<br />';


==========================================================================

Thanks I went through and checked those suggestions and it wasn't any of them...

What I am trying to do is to match a file name from a db to the file in the folder of images....
Which that part is working I can match them and display them, but it keeps telling me they aren't there ...right before it displays...



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux