Click here to get back home

List files from directory not in apache web directory

 HomeNewsGroups | Search

comp.lang.php - PHP programming language discussions 

get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
List files from directory not in apache web directory froditus 04-04-2008
Posted by froditus on April 4, 2008, 5:17 am
Please log in for more thread options
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.

Posted by George Maicovschi on April 4, 2008, 5:41 am
Please log in for more thread options
show/hide quoted text

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.

Posted by Michael Austin on April 5, 2008, 2:15 pm
Please log in for more thread options
froditus wrote:
show/hide quoted text


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:
show/hide quoted text
if ($mydir = @opendir("/my/dir/path"))
{
while($filename = readdir($mydir))
// if (eregi("^a_+[A-Za-z0-9_]+\.jpg", $filename))
echo "<option
show/hide quoted text
}
closedir($mydir);
show/hide quoted text

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.

Posted by Jerry Stuckle on April 5, 2008, 3:20 pm
Please log in for more thread options
froditus wrote:
show/hide quoted text

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@attglobal.net
==================


Similar ThreadsPosted
Create PHP pages from list of files in directory March 11, 2006, 9:27 am
how to copy files from ftp directory to web-accessible directory? November 21, 2006, 6:48 pm
how would I go about getting directory list to appear in a drop down menu March 2, 2005, 8:59 am
Is it possible to list directory content with CURL August 2, 2008, 12:48 pm
Recursive delete of directory - Directory not empty error April 14, 2008, 12:14 pm
Some php files in same directory of working files with same permissions won't process November 2, 2006, 10:33 pm
user uploaded files -- max # of files per directory? May 27, 2008, 9:24 pm
files from directory October 9, 2007, 4:10 am
Re: Help - make PHP pull a File List (dir/ls/etc) in a specific directory - print results February 27, 2006, 5:19 pm
include images from Apache protected directory June 6, 2005, 7:45 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Driving a better car - Fuelzilla.com

Cabling site for homeowners and pros alike - Cabling-Design.com

Friends:

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap
Privacy Policy