Introducing ComponentArt Upload

Posted Fri Mar 28, 2008 @ 5:21 AM

 

ComponentArt Web.UI 2008.1 includes one new addition to the library of controls: Upload. ComponentArt Upload is a file upload control with all the high-end AJAX and client-centric functionality one should expect from a Web.UI control.

 

The control comes with a custom server-side HTTP module for optimally processing the file upload, and an HTTP handler which provides upload progress information and otherwise enables communication between the module and the control on the client.

 

On the client, progress feedback is provided using client templates, in which all the metrics related to the upload (percentage, elapsed time, file sizes, speed, filenames, etc.) can be accessed and displayed in any layout the developer defines. File input fields (there can be more than one) are also formatted and styled using client templates, again with unlimited visual potential.

 

To configure an Upload control, the HTTP module and the handler must be added to the application’s web.config file:

<httpModules>
 <add type="ComponentArt.Web.UI.UploadModule, ComponentArt.Web.UI"
  name="ComponentArtUploadModule"/>
</httpModules>

<httpHandlers> <add verb="*" type="ComponentArt.Web.UI.UploadProgressHandler, ComponentArt.Web.UI" path="ComponentArtUploadProgress.axd" /> </httpHandlers>

 

Once this back-end infrastructure is in place, an Upload control can be placed on a page of the application:

<ComponentArt:Upload runat=”server” ID=”Upload1” TempFileFolder=”c:\temp\uploads” ... />

The Upload control writes files to disk as they come in, to prevent the waste of memory on the server, so TempFileFolder must be set on the control, to the absolute path of a folder where uploads are to be stored as they happen.

 

When an upload completes, the file(s) can be handled via the control’s Uploaded event, or by setting the DestinationFolder property, which will cause successful uploads to automatically be moved to the specified folder. In the latter case, automatic validation can also be performed before moving, using the AllowedFileExtensions and AllowedMimeTypes properties.

 

Styling of the control is done almost exclusively with client templates. The input area, as well as the progress feedback, can both be client-templated. In the latter case, extensive information on upload progress is available to be used in the template.

 

The progress client template (specified using the ProgressClientTemplateId property) is rendered in a popup over the upload control by default. If the ProgressDomElementId property is set, the client template will instead be rendered into the specified DOM element, allowing external controls to be used for progress feedback, such as the ComponentArt Dialog control.

 

The value of the boolean AutoPostBack property determines whether a postback will occur when the upload completes. If false, a callback is performed instead, and Upload's server-side event handler (or DestinationFolder logic) is still executed right away, without the page visibly reloading.

 

We hope you find this new control useful. We're pretty excited about what it brings to the field and the bar it sets for rich client-side styling and formatting. Try it out and let us know what you think.

 

You can start by checking out the Upload samples online.

 

Posted to For the Love of Data by milos

Posted on Fri Mar 28, 2008 @ 5:21 AM

Filed under: ,

Comments

Mike
Posted on Fri Mar 28, 2008 @ 5:21 AM
I tried the control when it was in beta. Had some trouble getting upload progress bar to work with the following configuration 1) Web gardens, i.e. multiple worker process for each IIS application pools 2) Windows Server 2008/IIS 7 integrated pipeline mode. The control works well with classic .NET mode. Any idea if the Upload control has been upgraded to work with the above configuration?
Posted on Fri Mar 28, 2008 @ 5:21 AM
Hey Mike, I got it working on my machine (Vista x64, IIS Integrated Pipeline) without a problem. Just make sure that the HTTP handlers/modules make their way into the portion of the web.config - I've had a few cases where appcmd.exe has messed my web.config during an upgrade (I had a link to a blog post about the problem but I can't find it at the moment)
Mike
Posted on Fri Mar 28, 2008 @ 5:21 AM
Great! That's good news. . Will give this a try when I'm back from business trip. Does the progress status bar works with web gardens? You need to set "Maximum Worker Processes" to more than 1 in "App Pool" "Advanced Settings"; and configure web app "Session State" to use "State Server". Control will definitely not work if it uses Application state instead of Session State to store upload progress status.
Posted on Fri Mar 28, 2008 @ 5:21 AM

I have been using Componentart Upload to upload files. I have copied exactly the same code as was given in Samples but i am unable to upload the file. During Debug i found it is going through the UploadBegin event then i dont know where it goes? Neither it comes to UploadEnd nor at UploadError Event.

Please Help

Anonymous comments are not allowed. Click here to log in or create an account.