
perlkid
stranger
Mar 1, 2000, 11:59 AM
Post #9 of 11
(3091 views)
|
Ok, I did something really silly, Your code works great, I accidentally put the dir path as the url. He He He. This is what I have now at the bottom of the program. <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> print qq(<p><select size="1" name="D1"> ); opendir (DIR, $dir) or die "can't open $dir: $!"; @files = map { "$dir/$_" } # a full path name sort # sort alphabetically grep { -f "$dir/$_" } # only files readdir (DIR); closedir (DIR); @files =~ ; for (@files) { print qq(<option value="$_">$_\n); } print qq(</select><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p> ); exit; </pre><HR></BLOCKQUOTE> Now I am trying to make it so that it only will print the names of the files and not the whole path to the file and file name. Because in the drop down form it looks like this; /path/to/image/dir/picture.gif all the way down. But they are in alphabetical order, and that's good. just two more steps and it will be complete. The next is to get it so that there are file names only, and the to only print files with certain extention. I tried using the s//g thing to get rid of the path before the picture but I never have used it before. Thank you very much Japhy, perlkid [This message has been edited by perlkid (edited 03-01-2000).]
|