This is a migrated thread and some comments may be shown as answers.

MaxFileInputsCount, maximum reached

7 Answers 228 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
René Hézser
Top achievements
Rank 1
René Hézser asked on 24 Jan 2011, 09:41 AM
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é

7 Answers, 1 is accepted

Sort by
0
Accepted
Genady Sergeev
Telerik team
answered on 26 Jan 2011, 12:33 PM
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.
0
René Hézser
Top achievements
Rank 1
answered on 26 Jan 2011, 12:35 PM
Thank you. The workaround solved the problem.

René
0
Adam
Top achievements
Rank 1
answered on 13 Feb 2011, 07:55 PM
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>
0
Genady Sergeev
Telerik team
answered on 16 Feb 2011, 04:43 PM
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.
0
Ömer faruk
Top achievements
Rank 1
answered on 29 Jun 2012, 02:51 PM
hi,

I wanted to remove invalid files. how do i it?
0
Joe
Top achievements
Rank 1
answered on 23 Dec 2015, 12:05 AM
Agree with Ömer. This solution does not include when an invalid file is removed (was never uploaded).
0
Plamen
Telerik team
answered on 24 Dec 2015, 07:09 AM
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
Tags
AsyncUpload
Asked by
René Hézser
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
René Hézser
Top achievements
Rank 1
Adam
Top achievements
Rank 1
Ömer faruk
Top achievements
Rank 1
Joe
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or