xmlns="Http://www.w3.org/1999/xhtml"> Id="Head1" Runat="Server"> <script Src="Jquery-1.7.1.min.js"></script> <script Src="Jquery.form.js"></script> <script Type="Text/javascript"> functionUpload() {$("#form1").Ajaxsubmit({Success: function (Str) {Alert(Str); },Error: function (Error) {Alert(Error); },Url: ' Handler1.ashx ', /* Set the page to which post is submitted */Type: "POST", /* Set up form to submit by post method */DataType: "Text" /* Set the return value type to text */ }); } </script><body> <form Id="Form1" Runat="Server" Enctype="Multipart/form-data"> <input Type="File" Id="File" Name="File" /> <asp:button Id="Button1" Runat="Server" Text=Upload OnClientClick="Upload();Return False;" /> </form>< span class= "tag" ></body>handler1.ashx<%@ webhandler language= "C #" Span class= "PLN" > class= "handler1" %> Using system;using System.web;public class Handler1:ihttphandler {public void ProcessRequest (HttpContext context) {Co ntext. Response.ContentType = "Text/plain"; Httppostedfile file = context. Request.files[0]; String fileName = System.IO.Path.GetFileName (file. FileName); File. SaveAs (context. Server.MapPath ("~/") + FileName); Context. Response.Write ("OK"); } public bool IsReusable {get {return false;}}}
Jquery.form.js Address
File Upload Lite