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.
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
0
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.
Dimiter Madjarov
the Telerik team
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
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.
Dimiter Madjarov
the Telerik team
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);
}
});
$("#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
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.
Dimiter Madjarov
the Telerik team
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.