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

how to only allow upload one file?

8 Answers 1040 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Ray
Top achievements
Rank 1
Ray asked on 11 Apr 2012, 05:55 PM
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

8 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 12 Apr 2012, 06:24 AM
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.
0
Ray
Top achievements
Rank 1
answered on 19 Apr 2012, 06:54 PM
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...
0
Accepted
Princy
Top achievements
Rank 2
answered on 20 Apr 2012, 06:46 AM
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.
0
Ray
Top achievements
Rank 1
answered on 25 Apr 2012, 02:58 PM
many many thanks!
0
Peter
Top achievements
Rank 1
answered on 20 Sep 2013, 06:12 AM
This seems unnecessarily complicated - I think I'll go back to the OOTB ASP.NET Upload control.
0
Kim
Top achievements
Rank 1
answered on 27 Oct 2015, 08:42 PM
Agreed, such great controls, but you have to jump through silly hoops for some basic functionality. 
0
Vessy
Telerik team
answered on 30 Oct 2015, 12:12 PM
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
0
Kim
Top achievements
Rank 1
answered on 30 Oct 2015, 04:02 PM
Thanks, I will give it a look.
Tags
Upload (Obsolete)
Asked by
Ray
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Ray
Top achievements
Rank 1
Peter
Top achievements
Rank 1
Kim
Top achievements
Rank 1
Vessy
Telerik team
Share this question
or