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

Allow only one file to e uploaded with upload

4 Answers 655 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Leonardo
Top achievements
Rank 1
Leonardo asked on 02 Jun 2014, 10:33 PM
I need to allow only a file to be uploaded. Change from upload files to upload file.

4 Answers, 1 is accepted

Sort by
0
Silver Lightning
Top achievements
Rank 1
answered on 03 Jun 2014, 04:25 AM
If you mean the text display, use this...


 Upload caption
    $("#files").closest(".k-upload-button")
                .find("span")
                .text("Select file...");
                
                
Hope this helps... God bless
0
Accepted
Dimiter Madjarov
Telerik team
answered on 03 Jun 2014, 08:26 AM
Hi Leonardo,


If you are referring to limiting the count of the uploaded files to one at a time, you could set the multiple option of the Upload widget to false.

If the question is related to the text of the Upload widget button, you could customize it via the localization.select option.

Let me know if this information helps.

Regards,
Dimiter Madjarov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Leonardo
Top achievements
Rank 1
answered on 03 Jun 2014, 08:35 AM
Actually, I need both.
Change the button caption to "Select file..."
But I need to use the upload widget to allow only one file to be uploaded.
Using the "multiple" option, I disallow multiples files to be uploaded at once. But the user can click on the "Select file..." and upload another file after the first one is uploaded.
I want to use it to upload a Profile picture, and I don't need more than one file.
I think I can use the events to disable the button "Select file..." after the first upload has finished. I would like to know if there is another way.
Thank you
0
Accepted
Dimiter Madjarov
Telerik team
answered on 03 Jun 2014, 09:53 AM
Hi Leonardo,


Indeed using the Upload widget events is the correct approach in the current case. For example you could bind to the success event, which will be fired after the first successful upload and disable the widget with the disable method so that no more files are selected.

Regards,
Dimiter Madjarov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Upload
Asked by
Leonardo
Top achievements
Rank 1
Answers by
Silver Lightning
Top achievements
Rank 1
Dimiter Madjarov
Telerik team
Leonardo
Top achievements
Rank 1
Share this question
or