This space is available to any ComponentArt employee to write about anything.

Introducing ComponentArt Upload

 

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.

 

Share this post: email it! | bookmark it! | digg it! | reddit!

Posted by: Milos
Posted: Friday, March 28, 2008 5:21 AM


Comments

Mike said:

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?
# March 28, 2008 8:34 AM

Steven Berkovitz said:

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)
# March 28, 2008 5:11 PM

Mike said:

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.
# April 3, 2008 6:35 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Blogs On This Site
Thoughts on web user interfaces and component development.
Ramblings of a web control developer.
Web.UI news and more
Next weeks guest: A dog and a baby dog!
I'm in your base, killing your dudes.
Absurdity is it's own message.
Musings of an ex Java developer
im in ur page, hackin ur codez
ComponentArt in the Community
... and the program ran happily ever after.

This Blog