Uploadify is a jquery upload plugin, the implementation of the effect is very good, with progress display. Uploadify Official website: http://www.uploadify.com/, the method used in MVC can refer to the use of JQuery uploadify in asp.net MVC3 and asp.net Use uploadify in MVC to implement picture scaling saves.
This article is a simple introduction demo, mainly dynamic transfer parameter method: Through the formdata to the handler to pass additional form data:
Copy Code code as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title></title>
<link href= "Uploadify/uploadify.css" type= "Text/css" rel= "Stylesheet"/>
<script type= "Text/javascript" src= "Uploadify/jquery-1.7.2.min.js" ></script>
<script type= "Text/javascript" src= "Uploadify/swfobject.js" ></script>
<script type= "Text/javascript" src= "Uploadify/jquery.uploadify.min.js" ></script>
<script type= "Text/javascript" >
$ (function () {
var taskId = "<%= taskId%>";
var ActivityID = "<%= ActivityID%>";
var userId = "<%= getcurrentloginuser (). ID%>";
$ ("#<%=fileupload1.clientid%>"). Uploadify (
{
' swf ': ' uploadify/uploadify.swf ',
' Uploader ': ' uploadhandler.aspx ',
' Auto ': false,
' method ': ' Post ',
' Multi ': true,
' ButtonText ': ' Browse ',
' buttonimg ': ' Uploadify/browse.jpg ',
' Folder ': '. /uploadfile ',
' Filedesc ': ' Attachment ',
' Onuploadstart ': function (event, data) {//this is where your'll send the form//data, but remember to get if from post In the. ashx file, by Contex. request["Gallaryid"]
$ ("#<%=fileupload1.clientid%>"). Uploadify (' Settings ', ' FormData ',
{' taskId ': taskId, ' ActivityID ': ActivityID, ' userId ': userId, ' Secinfo ': $ ("#<%=ddlsecinfo.clientid%>"). Val ()} Note Hiddengallaryid would//have the Gallaryid which im sending post, make through it are sure in rendered-page (/ /i.e.not concealed by a MultiView control e.t.c)
);
}
});
});
</script>
<body>
<form id= "Form1" runat= "Server" >
<asp:fileupload id= "FileUpload1" runat= "Server"/>
<asp:dropdownlist id= "Ddlsecinfo" runat= "Server" >
<asp:listitem text= "Public" value= "1" > </asp:ListItem>
<asp:listitem text= "Normal" value= "2" > </asp:ListItem>
<asp:listitem text= "Confidential" value= "3" > </asp:ListItem>
</asp:DropDownList>
<a href= "javascript: $ (' #<%=fileupload1.clientid%> '). Uploadify (' upload ', ' * ')" > Upload </a>
<a href= "javascript:$ (' #<%=fileupload1.clientid%> '). Uploadify (' Cancel ', ' * ')" > Cancel upload </a>
</form>
</body>