Allow only one file to e uploaded with upload

5 posts, 2 answers
  1. Leonardo
    Leonardo avatar
    5 posts
    Member since:
    Sep 2012

    Posted 02 Jun 2014 Link to this post

    I need to allow only a file to be uploaded. Change from upload files to upload file.
  2. Silver Lightning
    Silver Lightning avatar
    44 posts
    Member since:
    Feb 2014

    Posted 02 Jun 2014 in reply to Leonardo Link to this post

    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
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Answer
    Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2153 posts

    Posted 03 Jun 2014 Link to this post

    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.

     
  5. Leonardo
    Leonardo avatar
    5 posts
    Member since:
    Sep 2012

    Posted 03 Jun 2014 Link to this post

    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
  6. Answer
    Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2153 posts

    Posted 03 Jun 2014 Link to this post

    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.

     
Back to Top
UI for ASP.NET MVC is VS 2017 Ready