@{Viewbag.title="Home Page";}<script src=".. /.. /scripts/swfobject.js"Type="Text/javascript"></script><script src=".. /.. /scripts/jquery.uploadify.v2.1.4.js"Type="Text/javascript"></script><link href=".. /.. /content/uploadify.css"Rel="stylesheet"Type="Text/css"/><script type="Text/javascript">$ (document). Ready (function () {$ ("#uploadify"). uploadify ({'Uploader':'/content/uploadify.swf', 'Script':'/home/upload', 'cancelimg':'/content/cancel.png', 'folder':'UploadFile', 'Queueid':'Filequeue', 'Auto':false, 'Multi':true, 'OnComplete': Function (Event, ID, fileobj, response, data) { $('#div_img'). After (" "+ Response +"alt= ' height= ' width= '/>") } }); }); </script><div id="div_img"></div><div> <div id="Filequeue"style="Text-align:center"> </div> <input type="file"Name="uploadify"Id="uploadify"/> <p> <a href="javascript:$ (' #uploadify '). Uploadifyupload ()"> Upload </a> <a href="javascript:$ (' #uploadify '). Uploadifyclearqueue ()">Cancel Upload</a> </p></div>
Public stringUpload (Formcontext from) { varFile = request.files["Filedata"]; stringUploadpath = Server.MapPath ("~/images/"); stringURL ="/images/"+file. FileName; if(File! =NULL) {file. SaveAs (Uploadpath+file. FileName); returnUrl//returns the saved address } Else { return "0"; } }