Getting Started with the Multiple File Upload Control

All you have to do to use our Multiple Upload control is to register it on you page and save the received file as desired.

<%@ Register 
	Assembly="SharpPieces.Web.Controls" 
	Namespace="SharpPieces.Web.Controls" 
	TagPrefix="piece" %>

Set the control in your ASPX page and place the upload queue (as an Unordered Html tag).


<piece:Upload 
	runat="server" 
	id="fancyUpload" 
	onfilereceived="upload_FileReceived" 
	InstantStart="False" 
	Trigger="Button1" />

<ul class="photoupload-queue" id="photoupload-queue" />
        
<div>
	<asp:Button ID="Button1" runat="server" Text="Button" />
</div>

A trigger is optional. The selected files can be automatically sent to server once the browser's 'File Selection' window is closed. The uploaded files can then be easily accesed on the designated event handler.

    /// <summary>
    /// Handles the FileReceived event of the upload control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="UploadEventArgs"/> 
    instance containing the event data.</param>
    protected void upload_FileReceived(object sender, UploadEventArgs e)
    {
        if (e.File != null)
        {
            string savePath = Server.MapPath("Storage");

            e.File.SaveAs(savePath + "\\" + e.File.FileName);
        }
    }