7 Answers, 1 is accepted
0
Hello Bob,
You can use an accept HTML attribute, but keep in mind it is only supported by modern browsers.
Regards,
Dimo
the Telerik team
You can use an accept HTML attribute, but keep in mind it is only supported by modern browsers.
@(Html.Kendo().Upload()
.Name(
"files"
)
.HtmlAttributes(
new
{ accept =
"image/*"
})
)
Regards,
Dimo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

Igor
Top achievements
Rank 2
answered on 11 Oct 2013, 12:51 AM
Hi!
here is also one idea that might be useful for somebody
i have not tested if it could filter filesize, but i suspect so.
here is also one idea that might be useful for somebody
i have not tested if it could filter filesize, but i suspect so.
@(Html.Kendo().Upload()
.Name("docUpload")
.Multiple(false)
.ShowFileList(false)
.Events(e => e.Upload("onUpload"))
.Async(a => a
.Save("DocUpload", "Documents")
.AutoUpload(true))
)
<
script
>
function onUpload(e) {
var files = e.files;
$.each(files, function () {
if (this.extension.toLowerCase() != ".doc") {
alert("Only .doc files can be uploaded!")
e.preventDefault();
}
if (this.size / 1024 / 1024 > 5) {
alert("Max 5Mb file size is allowed!")
e.preventDefault();
}
});
}
</
script
>
0

Francis
Top achievements
Rank 1
answered on 20 Feb 2014, 06:49 PM
I would like the user to be able select only certain file types. For instance, ".csv" | ".xlsx" | "*.* All files". How do I achieve this?
0

Igor
Top achievements
Rank 2
answered on 20 Feb 2014, 07:10 PM
Well, according to documentation it is not possible yet to configure the file open dialog box.
You could only "catch" the upload event in order to have file extensions be filtered:
http://docs.telerik.com/kendo-ui/api/web/upload#events-upload
or you may use and alternative way to have extensions like that with jQuery:
http://stackoverflow.com/questions/8938124/how-to-filter-input-type-file-dialog-by-specific-file-type
You could only "catch" the upload event in order to have file extensions be filtered:
http://docs.telerik.com/kendo-ui/api/web/upload#events-upload
or you may use and alternative way to have extensions like that with jQuery:
http://stackoverflow.com/questions/8938124/how-to-filter-input-type-file-dialog-by-specific-file-type
0

krishna
Top achievements
Rank 1
answered on 31 Mar 2015, 07:04 AM
Is there any way yet, on how to configure the file open dialogue box as Igor said ?
I need to display the file extensions allowed, in the dropdown of that dialogue box, so that user can sort the files accordingly !
Kindly respond.
I need to display the file extensions allowed, in the dropdown of that dialogue box, so that user can sort the files accordingly !
Kindly respond.
0

krishna
Top achievements
Rank 1
answered on 31 Mar 2015, 07:05 AM
Is there any way yet, on how to configure the file open dialogue box as Igor said ?
I need to display the file extensions allowed, in the dropdown of that dialogue box, so that user can sort the files accordingly !
Kindly respond.
I need to display the file extensions allowed, in the dropdown of that dialogue box, so that user can sort the files accordingly !
Kindly respond.
0
Hello Gopikrishna,
You could use the accept html attribute to specify the files that should be displayed by default in the file selection window, but it it not possible to restrict the user from selecting another one by changing the value in the file types dropdown.
Regards,Dimiter Madjarov
Telerik
See What's Next in App Development. Register for TelerikNEXT.