Flex File Upload with ASP.NET
In my ongoing efforts to learn asp.net, I recently read about web handlers. Hmmm … seems like a convenient way to handle file upload from a Flex app. Although I’m much more comfortable with PHP, I hacked something together that worked okay on my server (.NET 2.0). I suspect others have blogged about this, but another example never hurts and I tried to distill this one down to a very simple level. Hopefully, it will be easy for other asp.net beginners to pick up on and expand.
There are some hacks in the .ashx file, including hardcoding the physical location of the upload folder on my server (which no longer exists after testing). I believe there is a more elegant way to specify the upload folder in the web.config file and then access it in the script using WebConfigurationManager.AppSettings. Haven’t had time to try that.
If you’re an experienced .NET pro, go ahead and laugh (although suggestions on making the process better are quite welcome). Beginners are welcome to download the files here (MXML and Uploader.ashx). It may go without saying, but make sure you have write access on the upload folder 🙂