Re: File Open
| From: | Ray Black III | Date: | Wed, 31 May 2000 14:30:53 +0000 |
| Subject: | Re: File Open | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-724@lists.php.net to get a copy of this message | ||
>
> Check these doc links for file system and directory functions:
>
> http://www.php.net/manual/ref.filesystem.php
> http://www.php.net/manual/ref.dir.php
>
> BTW have you ever thought about putting your thumbnails into a mysql db?
(In
> fact images & mysql is the today's top topic ;-) )
>
> Steff
That is painfully true. Images in a database are far less than optimal,
though we're finding today that way too many people are doing it. (Just
store the filenames, people! Spare your poor db servers the load!)
Anyway, here's how I've been getting a list of files into a dropdown list
from a directory listing:
<select size="1" name="Picture">
<option value="">[none]
<?
// --reading contents of image dir into dropdown--
$dir_ptr = opendir(IMAGE_PATH);
while ( $filename = readdir($dir_ptr) )
if ( $filename != "." && $filename != ".." ):
echo "\t\t<option value='" . $filename . "'";
if ($filename == $data_arr['Picture'])
echo " selected";
echo ">" . $filename . "\n";
endif;
closedir($dir_ptr);
// --end contents of image dir
?>
</select>
-r3-