ASP.NET AJAX Control Toolkit Demos v20.1.0.0

AjaxFileUpload Sample
Ajax Control Toolkit
AjaxFileUpload Demonstration
Click Select File to select an image file to upload. You can upload a maximum of 10 jpeg files (files with the .jpg or .jpeg extension)

AjaxFileUpload Description
AjaxFileUpload is an ASP.NET AJAX Control that allows you to asynchronously upload files to the server.
AjaxFileUpload Temporary Data

The AjaxFileUpload control buffers the file being uploaded onto your web server's hard drive. This temporary folder is located at Path.GetTempPath().

When you call the SaveAs() method to save the uploaded file to a new location, the AjaxFileUpload control deletes the temporary file automatically. If you don't call the SaveAs() method (for example, you are saving the uploaded file to a database) then you need to call the AjaxFileUploadEventArgs.DeleteTemporaryData() method to delete the temporary file.

AjaxFileUpload Handler

The AjaxFileUpload control uses an HTTP Handler named AjaxFileUploadHandler.axd This handler has the type AjaxControlToolkit.AjaxFileUploadHandler. You must add this handler to your Web.Config file in order for the AjaxFileUpload control to work.

Here's the Web.Config configuration that you must add:
        <add verb="*" path="AjaxFileUploadHandler.axd"
For IIS7:
    <validation validateIntegratedModeConfiguration="false" />
        <add name="AjaxFileUploadHandler" verb="*" 
AjaxFileUpload Events, Properties and Methods
  • AllowedFileTypes - A comma-separated list of allowed file extensions. The default is an empty string.
  • AutoStartUpload - Whether or not automatically start upload files after drag/drop or select in file dialog. The default is false
  • ChunkSize - The size of a chunk used by HTML5 to upload large files in bytes. The default is 4096.
  • ClearFileListAfterUpload - Whether or not to hide file upload list container after the uploading finished
  • IsInFileUploadPostBack - This will be true when a postback will be performed from the control. This can be used to avoid execution of unnecessary code during a partial postback. The default is false.
  • MaxFileSize - The maximum size of a file to be uploaded in Kbytes. A non-positive value means the size is unlimited. The default is 0.
  • MaximumNumberOfFiles - A maximum number of files in an upload queue. The default is 10.
  • Mode - How AjaxFileUpload displays a progress bar. The default is Auto.
  • OnClientUploadComplete - The name of a JavaScript function executed on the client side after a file is uploaded successfully.
  • OnClientUploadCompleteAll - The client script that executes when all of files in queue uploaded, or when user hits Cancel button to stop uploading
  • OnClientUploadError - The name of a JavaScript function executed on the client side if the file upload failed.
  • OnClientUploadStart - The name of a JavaScript function executed on the client side before any files are uploaded.
  • ServerPollingSupport - Whether or not AjaxFileUpload supports server polling.
  • ThrobberID - The ID of a control that is shown on the file upload. The throbber image is displayed for browsers that do not support the HTML5 File API or server-side polling.
  • UploadHandlerPath - Upload handler path
  • UseAbsoluteHandlerPath - Whether or not to use absolute path for AjaxFileUploadHandler

  • SaveAs(fileName) - Saves the uploaded file with the specified file name

  • UploadComplete - An event raised when the file upload is complete.
  • UploadCompleteAll - An event handler that will be raised when the UploadComplete event is raised in all files in an upload queue, or when a user presses the Cancel button to stop uploading.
  • UploadStart - An event raised when the file upload starts.
Copyright © 2012-2024 CodePlex Foundation. All Rights Reserved.