Detecting if the uploaded item is a folder or a file is not reliable on the client side. It is recommendable to do this on the server side. Here is a forum topic
, which discusses the topic further.
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI