/    Sign up×
Community /Pin to ProfileBookmark

link to files in directory

I have a directory that looks like this:

/home/httpsd/ra-new/weekly_ads/images/page_images/2004_02_01/e/

I need to create a function where the user sends us the date that they want to see and the region (e or w) and based on that, I give them a list of the images in that directory (as an array) that are links like this ([url]http://rawebdev.ra.server.com/weekly_ads/images/page_images/date/regions/image.jpg[/url]).

Thanks for any and all help.

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@clairec666Mar 05.2004 — Not sure about the date bit yet, but here's the rest of it for you:

<?php

$dir = /home/httpsd/ra-new/weekly_ads/images/page_images/2004_02_01/e/$_POST[region];

$Open = opendir($dir);

while(!(($File = readdir($Open)) == false )){

if (is_dir("$dir/$File")) {

print "";

}

else {

print "File: ";

}

print "<a href='$File'>$File</a><br />";

}

closedir($dir);

?>

A few things to point out:

$_POST[region] is the region that the user has sent you in a form.

The <a href> bit might not work. You may have to put the whole file path:

print "<a href='new/weekly_ads/images/page_images/2004_02_01/e/$_
POST[region]/$File'>$File</a><br />";

At the moment, it will show all files in that folder.
Copy linkTweet thisAlerts:
@jrthor2authorMar 05.2004 — the date is getting passed in also.

What I need to show is the actual link to the image, not an href itself.

I also need to put this in an array.

Thanks

EDIT.....................

I have it displaying the way I need it, but can you help me put it into an array??
×

Success!

Help @jrthor2 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...