The code in the Controller is the same as in the previous section (http://www.cnblogs.com/yechangzhong-826217795/p/3785842.html )
The code in the view is as follows:
<script type="Text/javascript">$ (function () {$ (". Uploadpic"). Each (function (i) {$ ('#uploadify'+i). Uploadify ({'ButtonText':'Uploading Files', 'SWF':'@Url. Content ("~/themes/scripts/uploadify/uploadify.swf")', 'Uploader':'/waste/user/upload', 'removecompleted':true, 'checkexisting':true, 'Filetypedesc':'File Type', 'filetypeexts':'*.jpg;*.png;*gif', 'Filesizelimit':'1024KB', 'Auto':true, 'width': $, 'Height': -, 'Multi':false, 'Queuesizelimit':1,//How many files are allowed to be uploaded? 'Queueid':'Filequeue'+ I,//specify where the upload progress bar is displayed//callback function after successful upload 'onuploadsuccess': function (file, data, response) {varobj = Jquery.parsejson (data);//converts the returned JSON sequence to an obj object if(obj. Success) {$ ('#input'+i). val (obj. FilePath); $('#upsucc'+ i). Text ('Upload Success! '); } Elsealert (obj. Message); } }); });
<li> <table> <tr> <td> @Html. labelfor (M =& Gt M.eiareport) </td> <td><div id="uploadify0" class="Uploadpic"></div> </td> <td><div id="FileQueue0" class="Filequeue"></div></td> <td> @Html. validationmessagefor (M = m.eiareport) <span id="upsucc0"style="color:red"></span></td> </tr> </table>@Html. textboxfor (M= M.eiareport,New{id ="input0", @style ="Display:none" }) </li> <li> <table> <tr> <td > @Html. labelfor (M = m.businesslicense) </td> <td><span id="uploadify1" class="Uploadpic"></span> </td> <td><div id="fileQueue1" class="Filequeue"></div></td> <td> @Html. validationmessagefor (M = m.businesslicense) <spa N id="UPSUCC1"style="color:red"></span></td> </tr> </table>@Html. textboxfor (M= M.businesslicense,New{id ="INPUT1", @style ="Display:none" }) </li> <li> <table> <tr> <td > @Html. labelfor (M = m.organizationcertificate) </td> <td><span id="uploadify2" class="Uploadpic"></span></td> <td><div id="fileQueue2" class="Filequeue"></div></td> <td> @Html. validationmessagefor (M = m.organizationcertificate) <span id="UPSUCC2"style="color:red"></span></td> </tr> </table>@Html. textboxfor (M= M.organizationcertificate,New{id ="Input2", @style ="Display:none" }) </li>