Applications that use uploadify for batch upload in mvc, mvcuploadify

Source: Internet
Author: User

Applications that use uploadify for batch upload in mvc, mvcuploadify

I found a lot of information on the Internet and did not find an easy-to-use uploadify batch upload application. Here I need to sort it out through the official and some of my projects. hope to help people who need it.

:

<Script type = "text/javascript" src = "/skin/js/laydate. js "> </script> <script type =" text/javascript "src ="/skin/js/uploadify/jquery. uploadify. min. js "> </script> <script type =" text/javascript "src ="/skin/js/uploadify/uploadify.swf "> </script> <script type =" text/ javascript "> $ (document ). ready (function () {$ ("# uploadFile "). uploadify ({/* Note the code of path to be written before */'swf ':'/skin/js/uploadify/uploadify.swf ', 'upl Oader ':'/task/uploadhandler', // request Action 'canonicalim': '/skin/js/uploadify/cancel.png', 'method': 'get ', 'queue id': 'filequeue ', // consistent with the id of the DIV storing the queue 'fileobjname': 'uploadfile', // consistent with the name attribute value of input, struts2 can handle 'auto': true, // whether to automatically start 'multi': true, // whether to support Multifile upload 'buttontext': 'upload ', // The text on the button 'simuploadlimit ': 1, // number of files uploaded simultaneously at a time 'sizelimmit': 19871202, // set the size limit for a single file // 'filedesc ': 'supported formats: jpg/gif/jpeg/png/ Bmp. ', // if the following 'text' attribute is configured, this attribute is required. // 'text ':'*. jpg ;*. gif ;*. jpeg ;*. png ;*. bmp ', // allowed format 'queuesizelimit': 5, // limit the number of times in a queue (several files can be selected ). The default value is 999, while several files can be uploaded at a time are determined by the simUploadLimit attribute. 'Filesizelimmit ': 10*1024*1024, // set the size limit for a single file. Unit: byte, 10 m' removecompleted': true, 'removetimeout': 0.5, 'requeueerrors ': true, // 'onuploadprogress': function (file, bytesUploaded, bytesTotal, totalBytesUploaded, totalBytesTotal, queueBytesLoaded) {// $ ("# result "). append ("<div> file \" "+ file. name + "\" Total "+ totalBytesTotal +" bytes, uploaded "+ totalBytesUploaded +" bytes! </Div> <br/> "); // if (totalBytesUploaded = totalBytesTotal) {// $ (" # result "). append ("<div> file \" "+ file. name + "\" uploaded successfully! </Div> <br/> "); //}, 'onuploadcomplete': function (file) {// $ (" # result "). append ("<div> file" + file. name + "uploaded successfully! </Div> <br/> ") ;}, 'onuploadsuccess': function (file, data, response) {if ($ (" # hidFile "). val () = "") {$ ("# hidFile "). val (data); $ ("# showFile "). text (data);} else {$ ("# hidFile "). val ($ ("# hidFile "). val () + "|" + data + ""); $ ("# showFile "). text ($ ("# showFile "). text () + ";" + data + "") ;}, 'onuploaderror': function (file, errorCode, errorMsg, errorString, swfuploadifyQueue) {// $ ("# result" ).html (errorString) ;},}) ;}); </script>JS call <div class = "item2 mt15"> <span class = "reg-tit3"> upload attachment: </span> <div class = "reg-inf"> <input type = "file" name = "uploadFile" id = "uploadFile" class = "pub-btn"/> <div id = "fileQueue"> </div> @ * <a href = "javascript: $ ('# uploadFile '). uploadify ('upload', '*') "> upload a file </a> <a href =" javascript: $ ('# uploadFile '). uploadify ('cancel ','*') "> cancel all uploads </a> * @ </div> <label id =" showFile "name =" showFile "> </label> </div> <div class = "fl ml158 mt5 f12 gray0"> up to five attachments can be added, the size of a single file cannot exceed 10 MB. <br> the file format can be uploaded: pdf, doc, docx, xls, ppt, wps, zip, rar, txt, jpg, jpeg, gif, bmp, swf, png, lsp; </div>View /// <summary> /// upload a file /// </summary> /// <returns> </returns> public string UploadHandler () {HttpPostedFileBase file = Request. files ["uploadFile"]; if (file! = Null) {string path = Common. configHelper. getConfigString ("picUpload") + "/Attachment"; string pathWjj = System. dateTime. now. toString ("yyyyMMdd"); string root = path + "/" + pathWjj; if (! Directory. exists (root) {Directory. createDirectory (root);} file. saveAs (root + "/" + file. fileName); return pathWjj + "/" + file. fileName;} else {return "0 ";}}Controller


Here, I also hope that I have an Asp.net MVC group 109681896, and I hope to join in discussions and learn about MVC.

 

 


Using uploadify for batch upload in. net

File Upload must be saved one by one. You cannot save all files at a time. Save the HttpPostedFileBase file multiple times

Uploadify batch upload Problems

Compression?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.