List files from directory not in apache web directory

Hello everyone,

is it possible to list files from directory other than in apache web
directory?
my web folder is placed on c:/ and i put my files in windows directory
"d:/files/images/".
I want those files to be able to view in client browser. when i tested
using server computer it succeed. but from client computer i got
nothing.
I checked the html sources and the files is directly loaded from "d:/
files/images/file_name.jpg" and then i found out why computer client
could not load that files.

is there any other way to make it happened ?

thank you guys for any kind of help.

best regards.
froditus [ Fr, 04 April 2008 11:17 ] [ ID #1935669 ]

Re: List files from directory not in apache web directory

On Apr 4, 12:17 pm, froditus <frodi... [at] gmail.com> wrote:
> Hello everyone,
>
> is it possible to list files from directory other than in apache web
> directory?
> my web folder is placed on c:/ and i put my files in windows directory
> "d:/files/images/".
> I want those files to be able to view in client browser. when i tested
> using server computer it succeed. but from client computer i got
> nothing.
> I checked the html sources and the files is directly loaded from "d:/
> files/images/file_name.jpg" and then i found out why computer client
> could not load that files.
>
> is there any other way to make it happened ?
>
> thank you guys for any kind of help.
>
> best regards.

It will not be accessible from the client computer because apache
cannot interpret the path.
You should build a php script that gets a parameter, let's say
'file_name.jpg' and goes and fetches it and than outputs it (using
gd). The script should know the image folder, and not $_GET it,
because that might be a security risk.

Cheers,
George.
George Maicovschi [ Fr, 04 April 2008 11:41 ] [ ID #1935671 ]

Re: List files from directory not in apache web directory

froditus wrote:
> Hello everyone,
>
> is it possible to list files from directory other than in apache web
> directory?
> my web folder is placed on c:/ and i put my files in windows directory
> "d:/files/images/".
> I want those files to be able to view in client browser. when i tested
> using server computer it succeed. but from client computer i got
> nothing.
> I checked the html sources and the files is directly loaded from "d:/
> files/images/file_name.jpg" and then i found out why computer client
> could not load that files.
>
> is there any other way to make it happened ?
>
> thank you guys for any kind of help.
>
> best regards.


html sources? post the code snippet on how you read the d:... directory.

I use something like this which creates a dropdown list of files in a
specific directory not under the htdocs directory structure:
echo "<form method=post action=mydosomething.php>";
echo "<br><tr><select name=dlfile>";
if ($mydir = [at] opendir("/my/dir/path"))
{
while($filename = readdir($mydir))
// if (eregi("^a_+[A-Za-z0-9_]+\.jpg", $filename))
echo "<option
value=$filename>$filename</option><br>";
}
closedir($mydir);
echo "</select><br><p>";

this submits to another php script that performs a specific tasks when
selecting a filename.

Remember that the web server will need read and/or write privs depending
on what you are doing with this. I would in no way make this executable
by the web server. Some OS's allow for explicitly being able to
disable executable while enabling read/write.
Michael Austin [ Sa, 05 April 2008 20:15 ] [ ID #1936247 ]

Re: List files from directory not in apache web directory

froditus wrote:
> Hello everyone,
>
> is it possible to list files from directory other than in apache web
> directory?
> my web folder is placed on c:/ and i put my files in windows directory
> "d:/files/images/".
> I want those files to be able to view in client browser. when i tested
> using server computer it succeed. but from client computer i got
> nothing.
> I checked the html sources and the files is directly loaded from "d:/
> files/images/file_name.jpg" and then i found out why computer client
> could not load that files.
>
> is there any other way to make it happened ?
>
> thank you guys for any kind of help.
>
> best regards.
>

This isn't a PHP question - what you need to do is configure your server
properly. Try alt.apache.configuration.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex [at] attglobal.net
==================
Jerry Stuckle [ Sa, 05 April 2008 21:20 ] [ ID #1936249 ]
PHP » comp.lang.php » List files from directory not in apache web directory

Vorheriges Thema: XPath help?
Nächstes Thema: php + mysql + localhost editor?