I needed a control that would upload multiple, large files (100+ MB), resume on error AND allow me to "catch" the uploaded files in C# code so I could perform my own manipulations, and I needed it fast. Hermes Java File Uploader was the answer, the only answer.
Here I am working on this web site for my current contractor and we determine that we have a need for uploading large files to the web server via. a public web page. In years of Asp.Net development I have actually never ran into this requirement on a website. I was lucky. This sounded to me like a very common task requiring a simple solution even though I had never come across the need in my development endeavors.
I was wrong.
The Asp.Net built-in methods for uploading large files is lacking at best. While the provided FileUpload may be sufficient for small uploads and certainly simplifies uploads from previous .Net versions it's not suitable for large file uploads, resuming interrupted uploads, or managing multiple uploads effectively.
The age old question comes "to develop, or not to develop". I started reading into the problem, and concurrently pricing 3rd party controls. To my dismay, while researching pure Asp.Net upload controls that would effectively solve all of my requirements I determined only one thing - such a thing doesn't exist! Well, that put quite a damper on my hopes of writing some quick elegant control in C#/Asp.Net that would handle all of my needs. Time is always of the essence and I just don't have the time to pull off a RYO control of this scale on the fly, especially with no samples of other people's working controls on CodeProject to get me started.
I swallow hard and realize I'm going to have to enter that scary untrustworthy world of JavaScript for my solution. I tried a few controls of varied prices and nothing really sat very well with me. Then I came across the Hermes Java File Uploader control.
I was instantly a little more comfortable with a Java control vs. a JavaScript control for obvious reasons.
The requirements I discovered I actually needed as I tested various controls were the following.
- Be able to browse the user's local file system and select multiple files easily.
- Manage selected files easily - add to, remove, etc. before clicking the upload button.
- Resume a broken upload no matter what happened, user clicks the back button AND says "Yes, I'm absolutely sure I know exactly what I'm doing even though we're at 99% complete on my upload" -or- my dedicated server which I manage that NEVER goes down because of an oversight on my part spontaneously combusts thus breaking the download through no fault of my own.
- Handle very large files up to a possible 100 MB.
- This is the kicker - be able to upload the file through the control but pass the handling off to C# code where I can further massage the upload.
It didn't do what I wanted right away. I should preface this with the fact that I am Java retarded and have about 2 hours of Google knowledge on how uploads work behind the scenes in Asp.Net. Which, in reality, isn't Asp.Net specific at all and is pretty much the same old HTML way of doing things with not much wrapping going on.
I try to smash round peg into square hole for a while and realize I don't know what the heck I'm doing so I contact the guys over at Hermes and this is where I'm blown away. I explain what I'm trying to do and the crunch I'm under, "please help me asap". I get a reply immediately telling me to try a couple of things so I do and it's still not working. I eat a big fat slice of humble pie and email back explaining how Java and Upload challenged I am and that I'm really in a bind and this control just has to work because there's nothing else even close, it just HAS TO.
Their team emails me back and suggests this: We open up an FTP account for them to access my server and they will take a look at what's going on, find the issue, fix it, upload it, solve it, and email me back when they're done. My jaw hit the floor. In 12 years of software development I can honestly say: never. Not only did they do exactly that but it was done that day!
You know what, this is a shameless plug for the Hermes team and their control. It's the least I could do for the unbelievable support and solution they provided. It's also not hard to get behind a control I'm using and very happy with. Kudos to Marek and the development and support teams over at Hermes for going light years above and beyond the call of duty to help out a single customer who incidentally was purchasing the cheapest version of their control.
A note for Asp.Net web developers. One thing that we did run into that I was unaware of... If you're going to be uploading large files to your website you will need to change a setting in your web.config to account for this.
HttpRuntimeSection..::.MaxRequestLength Property
I would suggest setting this in the code behind file where you "catch" your uploads.
The alternative is setting the value in your web.config file as found on MSDN. Making this a global setting in your web.config is probably not wise however and you should at least constrain the setting to a specific location on your website as a precaution.
Thanks and happy uploading.
No comments:
Post a Comment