<script type= "Text/javascript" src= "Jquery.uploadify.min.js" ></script
<link rel= "Stylesheet" href= "Uploadify.css" type= "Text/css"/>
<script type= "Text/javascript" > $ (document). Ready (function (){$ (' #uploadify '). Uploadify ({' swf '):' uploadify.swf ', ' buttontext ': ' Loading ', ' uploader ': ' Uploadhandler.ashx ', ' Queueid ': ' Filequeue ', ' queuesizelimit ': Ten, ' auto ': false, ' multi ': FAL SE, ' removecompleted ': true, ' filesizelimit ': ' 100MB ', ' filetypedesc ': ' Excel File ', ' filetypeexts ': ' *.xls ', ' onuploadsuccess ': function (file, data, response) { Layer.closeall ();layer.open ({type:1, Skin: ' Layui-layer-rim ',//Add border area: [' 520px ', ' 340px '],//Wide height Content: ' <div>file Name: ' + file.name + data + ' </div> '}); }, ' Onuploaderror ': function (event, Queueid, Fileobj, Errorobj){Layer.closeall (); }, ' Onuploadstart ': function (file){$ ("#uploadify"). Uploadify ("Settings", "FormData", {' ddlregion ':$ (' #ddlRegionSearch '). Val ()}); Dynamic parameters}); $ (' #supload '). Click (function supload (){$ (' #uploadify '). Uploadify (' upload ', ' * '); }); }); </script>
<Div> <inputtype= "File"name= "Uploadify"ID= "Uploadify" /><ButtonID= "Supload"class= "BTN">Start uploading</Button> </Div> <DivID= "Filequeue"></Div>
Public voidProcessRequest (HttpContext context) {context. Response.ContentType="Text/plain"; Context. Response.Charset="Utf-8"; Httppostedfile file= Context. request.files["Filedata"]; stringUploadpath = context. Request.mappath ("/upload/files/"); Try { if(File! =NULL) { stringFileName = Uploadpath +file. FileName; if(!directory.exists (Uploadpath)) {directory.createdirectory (Uploadpath); } //uploading files to the serverfile. SaveAs (FileName); Context. Response.Write ("<br>the Import is complete!"); } Else{context. Response.Write ("<br>file loading failure!"); return; } } Catch(Exception ex) {context. Response.Write ("<br>exception:"+Ex. Message); }}
Uploadify ASP. NET USE Notes