CFMU File Filters
CFMU is a multiple file upload custom tag written for ColdFusion in Flex. This is a much easier way to allow users the ability to upload files in your applications. If it is only 1 file it really is not a big deal but when you need to add many files this custom tag really comes through. Over the next couple of weeks I want to keep walking you through the many features this tag has to offer as well as how the code on the Flex side works.
Today we are going to walk through file filters. A file filter is a way to restrict what kind of files a user can select when clicking the browse button. This firstre image is the custom tag rendered to the screen along with the little code it takes.
Nothing to complicated about that, actually its pretty darn easy! Now let's say we wanted to add some file filters. When the user clicks the browse button and the open file dialog box shows up they will no longer be able to select just any file, only files we set up. To do this we will create a new array. The filters attribute must be an array. To keep It simple the array is going to hold the entire filter string. The whole string will be used as the description (what shows up in the files of type drop down below) and anything between ( and ) will contain the actual filters. For example, my new application will allow images, videos and documents. To do so I stup a new filters array add the following items to the array and pass that array into my custom tag.
You might be asking yourself, how the heck is he passing an array via flash vars to Flex? That would be pretty magical but as far as I know you can only pass strings through flash vars so we need to turn our array into a string. Whats its a string you can parse it on the Flex side. If you have a question of how to do so just let me know.
This is just one of many features I plan to show over the next couple weeks. Please download the project and let me know what you think. Any feedback, bugs or enhancements are welcome!
