locked
AjaxFileUpload does not limit number of files RRS feed

  • Question

  • User-2050663300 posted

    I am using maximum number of files in AjaxFileUpload. If I am assign value 2 to it then also it also allowing to select and upload more than 2 files.

    Please tell me how to prevent this problem ???

    Tuesday, November 26, 2013 3:11 AM

Answers

  • User-417640953 posted

    Hi jeeten,

    Thanks for your post.

    I made a demo using the AjaxFileUpload and set its attribute "MaximumNumberOfFiles" as 2.

    And it works fine as intended, if I select third file it will alert message "Maximum number of files exceeded".

     <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager>
     <asp:AjaxFileUpload ID="AjaxFileUpload1" MaximumNumberOfFiles="2" runat="server" OnUploadComplete="AjaxFileUpload1_UploadComplete" />
    

    If your code like above however cannot work as intended, I think there some relative javascript file not loaded in your page.

    You can check below link for more information or download latest ajax control toolkit.

    http://www.asp.net/AjaxLibrary/AjaxControlToolkitSampleSite/AjaxFileUpload/AjaxFileUpload.aspx

    If you still cannot figure it out, please share more information or code with us. Thanks.

    Best Regards!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, November 28, 2013 4:01 AM

All replies

  • User555306248 posted

    MaximumNumberOfFiles - This property enables you to limit the number of files that a user can add to the upload queue.

    http://forums.asp.net/p/1944287/5538581.aspx?how+to+limit+number+of+files+to+upload+in+ajax+file+upload+control+

    Tuesday, November 26, 2013 10:51 PM
  • User-2050663300 posted

    MaximumNumberOfFiles - This property enables you to limit the number of files that a user can add to the upload queue.

    I am already using it, But then also it is allowing to select more files.

    Tuesday, November 26, 2013 11:27 PM
  • User-417640953 posted

    Hi jeeten,

    Thanks for your post.

    I made a demo using the AjaxFileUpload and set its attribute "MaximumNumberOfFiles" as 2.

    And it works fine as intended, if I select third file it will alert message "Maximum number of files exceeded".

     <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager>
     <asp:AjaxFileUpload ID="AjaxFileUpload1" MaximumNumberOfFiles="2" runat="server" OnUploadComplete="AjaxFileUpload1_UploadComplete" />
    

    If your code like above however cannot work as intended, I think there some relative javascript file not loaded in your page.

    You can check below link for more information or download latest ajax control toolkit.

    http://www.asp.net/AjaxLibrary/AjaxControlToolkitSampleSite/AjaxFileUpload/AjaxFileUpload.aspx

    If you still cannot figure it out, please share more information or code with us. Thanks.

    Best Regards!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, November 28, 2013 4:01 AM