Re: Show filenames using Wildcards -- The glob() Solution!
| From: | Tijnema ! | Date: | Fri, 30 Mar 2007 14:33:02 +0000 |
| Subject: | Re: Show filenames using Wildcards -- The glob() Solution! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-251746@lists.php.net to get a copy of this message | ||
On 3/30/07, Rahul Sitaram Johari <sleepwalker@rahulsjohari.com> wrote:
Ave,
This Works!!!
<?php
foreach (glob("vox/".$row['PHONE']."*.vox") as $value) {
echo "<OPTION
VALUE='takekey_download.php?F=vox/".basename($value)."'>".basename($value)."
</option>";
}
?>
Dug up glob() in the manual, followed examples and details works like a
charm!
Full code:
<SCRIPT LANGUAGE="JavaScript">
function openVox(form) {
var newIndex = form.voxSelect.selectedIndex;
if (newIndex == 0) {
//alert( "Please select a file to download!" );
} else {
dlvox = form.voxSelect.options[newIndex].value;
window.location.assign(dlvox);
}
}
</SCRIPT>
<FORM NAME="voxForm" STYLE="margin: 0px; padding: 0px;">
<SELECT NAME="voxSelect" onChange="openVox(this.form)">
<OPTION>... Choose Recording ...</OPTION>
<?php
foreach (glob("vox/".$row['PHONE']."*.vox") as $value) {
echo "<OPTION
VALUE='takekey_download.php?F=vox/".basename($value)."'>".basename($value)."
</option>";
}
?>
</SELECT>
</FORM>
Thanks!
I see you're using glob now, but I found this comment in your other thread:
"Yes, and while I dig up on glob(), to be quite honest, the exec is working
very effectively and fast for my searches & download application - so can't
complain about it one bit."
I didn't test both myself, but you might want to see the difference in
performance.
Tijnema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: sleepwalker@rahulsjohari.com ³I morti non sono piu soli ... The dead are no longer lonely²