RE: Displaying An Image / Non-Web accessible Dir

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

 



Hi Jason,

I wonder if permissions are my problem, but... When I try and fopen the
file (using rb flags for read and binary) and try to do an fstat it
doesn't return any of the specific file information at all (lots of
zeros). I'm running Apache 2.0.51 under the LocalSystem account, and so
I assume that PHP which is loaded as an Apache module would attempt to
access the file as whatever user the Apache service is using. In which
case LocalSystem SHOULD have access. It's frustrating because I know I'm
probably missing something simple!

Armando

-----Original Message-----
From: Jason Barnett [mailto:jasbarne@xxxxxxxxxxx] 
Sent: November 2, 2004 7:13 AM
To: php-windows@xxxxxxxxxxxxx
Subject: Re:  Displaying An Image / Non-Web accessible Dir


> Can you or someone suggest how I can access an image file on my drive 
> which is not part of the http-accessible directories (say in
> C:\images\somepic.jpg) and display the filetype? I think once I can at
> least get that to work, the rest should be fairly simple.

If all goes well, the only thing you should need to do to open that file
would 
be to open a file with a file pointer and then do whatever you want with
the 
file pointer.  Your PHP user will need read and / or write access to the
file(s) 
in question, you can right-click them to check on this.

<?php

// any file, so long as PHP user can read it
$file = 'C:\\images\\somepic.jpg';
$fp = fopen($file, 'r');
// do stuff, not sure what you wanted ewxactly but this gives you an
idea echo 'Is this a directory?  '; echo is_dir($fp) ? 'yes' : 'no';
echo '<pre>'; print_r(fstat($fp)); echo '</pre>'; // etc.

?>

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

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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux