Uploadif is slightly extended and uploadif is extended
Article from Uploadify extended configuration using http://www.wuyinweb.com/doc/52/57.aspx
Multiple files are uploaded in the project. After filtering, the Uploaidify option is selected. However, another problem is that the uploaded files can be classified, I do not want to add multiple Uploaidify controls to the page, so I will make some modifications.
Results:
<Div id = "UploadBox"> <div class = "ops"> <input type = "file" name = "uploadify" id = "uploadify"/> <input type =" button "id =" btnUpload "value =" "/> <input type =" button "id =" btnCancel "value =" "/> </div> <div id =" fileQueue "> </div> <! -- File type box --> <select> <asp: repeater runat = "server" ID = "repTypes"> <ItemTemplate> <option value = '<% # Eval ("id ") %> '> <% # Eval ("vc_TypeName") %> </option> </ItemTemplate> </asp: Repeater> </select>
JS
$ (Document). ready (function () {$ ("# uploadify"). uploadify ({swf: 'theuploadify/uploadify.swf ', uploader: 'theuploadify/Upload. aspx? ID = '+ <% = ID %> +' & DataID = '+ <% = DataID %> + '', cancelImg: 'theuploadify/cancel.png', formData: {'folder': 'uploadfile'}, progressData: 'speed', fileSizeLimit: '0000kb', queueID: 'filequeue ', auto: false, multi: true, height: 27, buttonImage: 'theuploadify/selectFile.jpg ', wmode: 'transparent', onUploadComplete: function (event, queueID, fileObj, response, data) {// alert (fileObj. name); File Uploaded successfully}, onError: function (event, queueID, fileObj) {alert ("file:" + fileObj. name + "Upload Failed");}, onUploadStart: function (file) {// ******** according to file. id to find every entry var attachType =$ ("#" + file. id ). find ("select "). val (); this. addPostParam ("attach_type", attachType); this. addPostParam ("file_name", encodeURI (file. name); // Add the file name parameter} in the onUploadStart event, and refresh the window after the onQueueComplete: function () {// all files are uploaded. location. href = window. location. href;}, onDialogClose: function () {var attachTypes =$ ("# attachTypes"); // var items = $ (". fileName "); if (items. length> 0) {items. each (function () {var nowitem = $ (this); if (nowitem. parent (). find ("select "). length <1) {var cloneTypes = attachTypes. clone (); cloneTypes. removeAttr ("id"); cloneTypes. insertAfter (nowitem) ;}}}}); // starts to upload $ ("# btnUpload "). click (function () {$ ("# uploadify "). uploadify ('upload', '*') ;}); // cancel upload $ ("# btnCancel "). click (function () {$ ("# uploadify "). uploadify ('cancel ','*');});});
The main principle is to trigger the onDialogClose event when the select text dialog box is closed, and add the type to the specified position of the Entry