MaxFileInputsCount, maximum reached

8 posts, 1 answers
  1. René Hézser
    René Hézser avatar
    18 posts
    Member since:
    Oct 2009

    Posted 24 Jan 2011 Link to this post

    Hi,
    my page has a maximum of 10 allowed files. If all ten files are uploaded, the upload button disappears.
    When a file is removed, the upload button does not appear again, until all files are removed from the control.

    <telerik:RadAsyncUpload runat="server" ID="AsyncUpload" MaxFileSize="5242880" CssClass="DokumentUpload"
        EnableViewState="true" EnableInlineProgress="true" InputSize="30" Culture="DE-de"
        MaxFileInputsCount="10"
        MultipleFileSelection="Disabled" AllowedFileExtensions="pdf,doc,docx,ppt,pptx,gif,png,jpg,tif,tiff,txt"
        OnFileUploaded="RadAsyncUploadFileUploaded" OnClientFileUploading="fileUploading"
        OnClientFilesUploaded="filesUploaded" OnClientFileUploadRemoved="fileRemoved"
        OnClientFileUploadFailed="fileUploadFailed" OnClientValidationFailed="validationFailed">
        <Localization Select="Hochladen" Cancel="Abbrechen" Remove="Entfernen" />
    </telerik:RadAsyncUpload>

    If anybody has a solution for this behavior, please tell me :-)

    René
  2. Answer
    Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 26 Jan 2011 Link to this post

    Hello René Hézser,

    This seems to be a bug in RadAsyncUpload. I've logged it into our bug tracking system and we are ought to fix it for the upcoming Q1 release. Meanwhile, you can use the following workaround:

    <script type="text/javascript">
        varcount = 0;
        functionadded(sender, args) {
            count = args.get_index();
        }
      
        functionremoved(sender, args) {
            count--;
            if(count < 4)
                sender.addFileInput();
        }
    </script>
      
    <telerik:RadAsyncUpload runat="server"ID="RAdAsyncUpload1"MaxFileInputsCount="4"OnClientAdded="added"OnClientFileUploadRemoved="removed">
    </telerik:RadAsyncUpload>


    Kind regards,
    Genady Sergeev
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. René Hézser
    René Hézser avatar
    18 posts
    Member since:
    Oct 2009

    Posted 26 Jan 2011 Link to this post

    Thank you. The workaround solved the problem.

    René
  5. Adam
    Adam avatar
    4 posts
    Member since:
    Sep 2010

    Posted 13 Feb 2011 Link to this post

    This workaround solves the reported problem, but creates another problem that might be considered worse.

    With the proposed workaround, if you upload 4 files and remove the last file, you do indeed get a file selection input again...BUT, if you remove another file, you get ANOTHER file selection. So if you upload 4 files and then decide you don't want them, and delete all 4, you end up with *4* input boxes.

    After playing around with it, I came up with a alternate workaround which doesn't seem to have this adverse side effect:

    First the Javascript

    <script type="text/javascript">
        var FilesUploaded = 0;
        var MaxFileCount = 3; //Whatever you want the max to be
      
        function onFileSelected(sender, args) {
            FilesUploaded++;
        }
      
        function onFileUploadRemoved(sender, args) {
            if (MaxFileCount == FilesUploaded)
                sender.addFileInput();
      
            FilesUploaded--;
        }
    </script>

    And then the actual ASPX control:

    <telerik:RadAsyncUpload runat="server" ID="RadAsyncUpload1" MaxFileInputsCount="3" OnClientFileSelected="onFileSelected" OnClientFileUploadRemoved="onFileUploadRemoved">
    </telerik:RadAsyncUpload>
  6. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 16 Feb 2011 Link to this post

    Hello Kathryn,

    Thank you for sharing this workaround with the community. I've updated your telerik points as a token of gratitude for the involvement.

    Best wishes,
    Genady Sergeev
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  7. Ömer faruk
    Ömer faruk avatar
    3 posts
    Member since:
    Jun 2012

    Posted 29 Jun 2012 Link to this post

    hi,

    I wanted to remove invalid files. how do i it?
  8. Joe
    Joe avatar
    3 posts
    Member since:
    Dec 2015

    Posted 22 Dec 2015 in reply to Ömer faruk Link to this post

    Agree with Ömer. This solution does not include when an invalid file is removed (was never uploaded).
  9. Plamen
    Admin
    Plamen avatar
    2729 posts

    Posted 24 Dec 2015 Link to this post

    Hello,

    You can refer to this forum thread where similar scenario is discussed.

    Regards,
    Plamen
    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017