how to only allow upload one file?

Thread is closed for posting
9 posts, 1 answers
  1. Ray
    Ray avatar
    8 posts
    Member since:
    Mar 2012

    Posted 11 Apr 2012 Link to this post

    Hi experts,

    I know this sounds stupid ... but how to remove 'add' button so user can only upload one single file or a pre defined number of files?

    Many thanks,
    Ray
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 12 Apr 2012 Link to this post

    Hi Ray,

    You can set the MaxFileInputsCount property of the RadUpload. The MaxFileInputsCount property specifies the maximum number of rows that can appear in the RadUpload control. Once the RadUpload control contains this number of rows, the Add button is disabled until a row is deleted.

    ASPX:
    <telerik:RadUpload ID="RadUpload1" runat="server" MaxFileInputsCount="1">
    </telerik:RadUpload>

    Regards,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ray
    Ray avatar
    8 posts
    Member since:
    Mar 2012

    Posted 19 Apr 2012 Link to this post

    I see, however can I remove both 'delete' button and 'add' button at the same time? although the 'add' button can be disabled but still visible...
  5. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 20 Apr 2012 Link to this post

    Hi Ray,

    Try the following code snippet to remove the Add and Delete button after reaching the MaxFileInputsCount.

    ASPX:
    <telerik:RadUpload ID="RadUpload1" runat="server" MaxFileInputsCount="3" OnClientAdded="OnClientAdded">
    </telerik:RadUpload>

    JS:
    <script type="text/javascript">
    function OnClientAdded(sender, args)
       {
          if (sender.getFileInputs().length == sender.get_maxFileCount())
             {
                $telerik.$(".ruDelete").remove();
                $telerik.$(".ruAdd").remove();
             }
       }
    </script>

    Hope this helps.

    Regards,
    Princy.
  6. Ray
    Ray avatar
    8 posts
    Member since:
    Mar 2012

    Posted 25 Apr 2012 Link to this post

    many many thanks!
  7. Peter
    Peter avatar
    98 posts
    Member since:
    Mar 2012

    Posted 20 Sep 2013 Link to this post

    This seems unnecessarily complicated - I think I'll go back to the OOTB ASP.NET Upload control.
  8. Kim
    Kim avatar
    23 posts
    Member since:
    Dec 2012

    Posted 27 Oct 2015 in reply to Peter Link to this post

    Agreed, such great controls, but you have to jump through silly hoops for some basic functionality. 
  9. Vessy
    Admin
    Vessy avatar
    1389 posts

    Posted 30 Oct 2015 Link to this post

    Hi Kim,

    Indeed the RadUpload control has some missing built-in functionalities. Please note that it has been deprecated in the RadAsyncUpload's favor and is not developed any more. The AsynUpload control on another hand can achieve the desired look only with a simple configuration, so you can consider using it in your project:
    <telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" MaxFileInputsCount="1" MultipleFileSelection="Disabled"></telerik:RadAsyncUpload>

    I hope this information will be helpful for you.

    Regards,
    Vessy
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  10. Kim
    Kim avatar
    23 posts
    Member since:
    Dec 2012

    Posted 30 Oct 2015 in reply to Vessy Link to this post

    Thanks, I will give it a look.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017