今天见园友发的文章在介绍jquery file upload插件,忍不住去实操了一把,支持多选(IE除外),有上传进度条,上传完可以预览,能批量删除,批量停止下载等常功能,并且是非Activex,非Flash的,文件也不大,感觉还不错。
但不是MVC的,于是乎,网上找了一个Demo,本地运行之后,发现有一点小Bug,但瑕不掩瑜,这里分享给园友,有兴趣的可以来下载。
Demo中引用的JS和Css有Bug,修改后,还发现有些是可以删除的,删除后代码如下:
@{ ViewBag.Title = "Bootstrap version demo"; Html.RequiresCss("Bootstrap/bootstrap.min.css", "Content", 2); //Html.RequiresCss("Bootstrap/bootstrap-responsive.min.css", "Content", 3); //Html.RequiresCss("Bootstrap/bootstrap-image-gallery.min.css", "Content", 4); Html.RequiresCss("FileUpload/jquery.fileupload-ui.css", "Content", 5); Html.RequiresJs("jquery/1.7.1/jquery.min.js", "googleCDN", 1); Html.RequiresJs("jqueryui/1.8.18/jquery-ui.min.js", "googleCDN", 2); Html.RequiresJs("FileUpload/tmpl.min.js", "Content", 5); //Html.RequiresJs("FileUpload/canvas-to-blob.min.js", "Content", 5); //Html.RequiresJs("FileUpload/load-image.min.js", "Content", 5); //Html.RequiresJs("Bootstrap/bootstrap-image-gallery.min.js", "Content", 6); //Html.RequiresJs("Bootstrap/bootstrap.min.js", "Content", 6); Html.RequiresJs("FileUpload/jquery.iframe-transport.js", "Content", 10); Html.RequiresJs("FileUpload/jquery.fileupload.js", "Content", 10); Html.RequiresJs("FileUpload/jquery.fileupload-ip.js", "Content", 20); Html.RequiresJs("FileUpload/jquery.fileupload-ui.js", "Content", 30); Html.RequiresJs("FileUpload/locale.js", "Content", 90); Html.RequiresJs("FileUpload/main.js", "Content", 99); }
当然有些引用文件很小,可以合并,这里没有合并,有兴趣可以二次加工,以方便使用。
运行后效果如下: