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

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

6 Answers 171 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Jianwei
Top achievements
Rank 1
Jianwei asked on 13 Mar 2013, 03:21 PM
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.

6 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 14 Mar 2013, 03:28 PM
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!
0
Jianwei
Top achievements
Rank 1
answered on 14 Mar 2013, 11:08 PM
Does it work if I have async object?
0
Dimiter Madjarov
Telerik team
answered on 15 Mar 2013, 12:37 PM
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!
0
Jianwei
Top achievements
Rank 1
answered on 17 Mar 2013, 04:47 PM
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);
            }
        });
0
Dimiter Madjarov
Telerik team
answered on 18 Mar 2013, 03:31 PM
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!
0
Accepted
Jianwei
Top achievements
Rank 1
answered on 19 Mar 2013, 02:39 AM
Great. The example does help me identify the issue, I think I didn't put the removeUrl into the configuration. 

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