Categories
Archives
When technology isn't the power behind a killer software feature | Home | Formatting Debug Output with print_r(
Filed under Quick Tips on May 9, 2008 by Javier JulioMultiple File Extension Filters For CFDirectory
In a recent blog post by Ben Nadel (which should be his...oh, I don't know...56,423rd CF tip?!) he explained that by using the pipe character you can specify multiple file extension filters on the cfdirectory tag. For example, you can do the following:
That would return only Excel and CSV files. You can specify more filters by simply separating them with a pipe character. It seems like the Adobe Documentation team needs to update the ColdFusion Reference because it currently states the following for the filter attribute:
"File extension filter applied to returned names, for example, *.cfm. One filter can be applied."
Such a helpful tip really ought to be stated in the documentation or, even better yet, used as an example. So instead, I'll do all the work for you! Here is an example I wrote up matching the style used in the cfdirectory reference page:
Trackback Pings (TrackBack URL for this entry)
http://www.arc90.com/cgi-bin/mt4/mt-tb.cgi/147.
Comments
This is a great discovery and example, thanks for sharing it, I hope Adobe sees this and updates the slim docs!
Posted on May 9, 2008 6:04 PM by Hatem Jaber
@Javi,
Nicely done due. Way to fill in the documentation gaps!
Posted on May 9, 2008 7:25 PM by Ben Nadel
Thanks guys! Hope this helps others out there! I could have used this myself earlier and even fellow co-worker Doug Burns pointed out the same. This is such a handy tag just never made sense that you could only provide one filter. Hopefully this gets add to the CF Reference in some form to help others!
Posted on May 9, 2008 7:41 PM by Javier Julio
@Javi,
Good job finding this little gem. I stumbled across this a while back, and Im glad to see it blogged on. I "assumed" it was just known. For me it was just an accident that i tried this and it worked. I need to start blogging!
Cheers man!
Matthew
Posted on May 15, 2008 5:00 PM by Matthew Abbott
When technology isn't the power behind a killer software feature | Main | Formatting Debug Output with print_r(

Thanks for sharing. :)
I guess Adobe has been too busy making fancy doo-dads to keep up on the docs! Maybe they should look into hiring Luis Majano! :)
Posted on May 9, 2008 5:08 PM by Jason Durham