Is there a way to only show the last uploaded files in k-upload-files sections

7 posts, 1 answers
  1. Jianwei
    Jianwei avatar
    20 posts
    Member since:
    Feb 2011

    Posted 13 Mar 2013 Link to this post

    My control only allows one file to be uploaded, and I want the k-upload-files section only show the latest file , not the list of files. Is there a configuration that I can change to achieve this?

    In my attached image, I only want the second file displayed when the user choose to upload a different image.
  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2159 posts

    Posted 14 Mar 2013 Link to this post

    Hi Jianwei,


    Since the current scenario requires that only one file should be uploaded at a time, you could set the multiple option of Kendo Upload to false. Here is a JS Bin example, which demonstrates this.

     

    All the best,
    Dimiter Madjarov
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Jianwei
    Jianwei avatar
    20 posts
    Member since:
    Feb 2011

    Posted 14 Mar 2013 Link to this post

    Does it work if I have async object?
  5. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2159 posts

    Posted 15 Mar 2013 Link to this post

    Hi Jianwei,


    Yes, this approach will work for async upload too.Please keep in mind that if the autoupload option is set to true, even if the multiple option is set to false, this will not limit the total number of uploaded files, it will just force the user to select a single file at a time.

     

    Greetings,
    Dimiter Madjarov
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  6. Jianwei
    Jianwei avatar
    20 posts
    Member since:
    Feb 2011

    Posted 17 Mar 2013 Link to this post

    Here is what I have now, but it's still allow me to upload multiple files?  Any idea?

      $("#ceContentFileUpload").kendoUpload({
                async: {
                    saveUrl: '@(Url.Action("SaveResource", "File"))',
    autoUpload:false
                },
                multiple: false,
                upload: function (up) {
                    up.data = { parentEntityId: '@(Model.ParentId)' };
                },
                success: function (up) {
                    var fileName = up.files[0].name;
                    vm.contentName(fileName);
                    vm.hyperLinkText(fileName);
                },
                error: function (up) {
                    $.growlUI('Error', 'Unable to upload file. Please try again or contact the system administrator if the problem persists', 2000);
                }
            });
  7. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2159 posts

    Posted 18 Mar 2013 Link to this post

    Hello Jianwei,


    Your code seems correct. Please take a look at the attached example and let me know if it covers your scenario. If that is not the case, could you explain what is the expected behavior?

    I am looking forward to hearing from you.

     

    Regards,
    Dimiter Madjarov
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  8. Answer
    Jianwei
    Jianwei avatar
    20 posts
    Member since:
    Feb 2011

    Posted 18 Mar 2013 Link to this post

    Great. The example does help me identify the issue, I think I didn't put the removeUrl into the configuration. 

Back to Top
Kendo UI is VS 2017 Ready