locked
AjaxFileUpload control vs. AsyncFileUpload control? RRS feed

  • Question

  • User-1883719206 posted

    hi,

    can someone tell me what is the difference between the AjaxFileUpload control and the AsyncFileUpload control?

    can anyone post an examples for those controls?

    i tried to use the AjaxFileUpload and got an java script error can anyone also tell me what's wrong there?

    thank you.

    Monday, August 6, 2012 5:39 AM

Answers

  • User555306248 posted

    AsyncFileUpload - AsyncFileUpload is an ASP.NET AJAX Control that allows you asynchronously upload files to server. The file uploading results can be checked both in the server and client sides.

    AjaxFileUpload- AjaxFileUpload is an ASP.NET Ajax control which enables you to upload multiple files to the server asynchronously. When the control is used with a browser which supports  the latest features of HTML5 -- such as Microsoft Internet Explorer 10, Mozilla            Firefox 9, or Google Chrome 17 -- then the AjaxFileUpload supports displaying file upload progress. The control displays a progress bar as the file is being uploaded.       

                If a browser does not support the HTML5 File API (for example, Internet Explorer  9) then upload progress is not displayed and a throbber image is displayed instead. In other words, a busy wait image is displayed instead of actual progress.       

                The AjaxFileUpload control also supports a drag-and-drop interface. You can add multiple files to the AjaxFileUpload upload queue by dragging the files onto the AjaxFileUpload control on a page. Alternatively, you can select multiple files to upload by using the SHIFT key or CTRL key when selecting files with the file upload dialog. These features are not supported by older browsers.       

                By taking advantage of the AllowedFileTypes property, you can restrict the types  of files which can be uploaded with the AjaxFileUpload control. For example, you can prevent any file except image files (files with the extensions jpeg, png, or gif) from being uploaded. By taking advantage of the MaximumNumberOfFiles property,  you can limit the number of files which can be uploaded with the control. For example, you can prevent a user from uploading more than 5 files.         

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, August 6, 2012 11:22 PM

All replies

  • User-588618247 posted

    <script type="text/javascript">
    function showUploadConfirmation() {
    alert("Upload finished!");
    }
    </script>

    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </asp:ToolkitScriptManager>
    <asp:AsyncFileUpload ID="AsyncFileUpload2" runat="server" UploadingBackColor="Yellow"
    OnUploadedComplete="ProcessUpload"
    OnClientUploadComplete="showUploadConfirmation" ThrobberID="spanUploading"
    ClientIDMode="AutoID"/>

    <span id="spanUploading" runat="server">Uploading...</span>

    at .cs page

    protected void ProcessUpload(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
    {
    string imgName = AsyncFileUpload2.FileName.ToString();
    string imgPath = "ImageStorage/" + imgName;
    AsyncFileUpload2.SaveAs(Server.MapPath(imgPath));
    }

    Actually unexpected error u get i think for not doing ClientIDMode="AutoID" at right click control at design...go to property...make ClientIDMode="AutoID"

    It is working ...check it out.


    Monday, August 6, 2012 8:48 AM
  • User555306248 posted

    AsyncFileUpload - AsyncFileUpload is an ASP.NET AJAX Control that allows you asynchronously upload files to server. The file uploading results can be checked both in the server and client sides.

    AjaxFileUpload- AjaxFileUpload is an ASP.NET Ajax control which enables you to upload multiple files to the server asynchronously. When the control is used with a browser which supports  the latest features of HTML5 -- such as Microsoft Internet Explorer 10, Mozilla            Firefox 9, or Google Chrome 17 -- then the AjaxFileUpload supports displaying file upload progress. The control displays a progress bar as the file is being uploaded.       

                If a browser does not support the HTML5 File API (for example, Internet Explorer  9) then upload progress is not displayed and a throbber image is displayed instead. In other words, a busy wait image is displayed instead of actual progress.       

                The AjaxFileUpload control also supports a drag-and-drop interface. You can add multiple files to the AjaxFileUpload upload queue by dragging the files onto the AjaxFileUpload control on a page. Alternatively, you can select multiple files to upload by using the SHIFT key or CTRL key when selecting files with the file upload dialog. These features are not supported by older browsers.       

                By taking advantage of the AllowedFileTypes property, you can restrict the types  of files which can be uploaded with the AjaxFileUpload control. For example, you can prevent any file except image files (files with the extensions jpeg, png, or gif) from being uploaded. By taking advantage of the MaximumNumberOfFiles property,  you can limit the number of files which can be uploaded with the control. For example, you can prevent a user from uploading more than 5 files.         

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, August 6, 2012 11:22 PM