求一段C# jquery上传图片的代码。 RTRTRTRTRTRTRTR 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1" runat="server"> <script src="jquery-1.7.1.min.js"></script> <script src="jquery.form.js"></script> <script type="text/javascript"> function upload() { $("#form1").ajaxSubmit({ success: function (str) { alert(str); }, error: function (error) { alert(error); }, url: 'handler1.ashx', /*设置post提交到的页面*/ type: "post", /*设置表单以post方法提交*/ dataType: "text" /*设置返回值类型为文本*/ }); } </script></head><body> <form id="form1" runat="server" enctype="multipart/form-data"> <input type="file" id="file" name="file" /> <asp:Button ID="Button1" runat="server" Text="上传" OnClientClick="upload();return false;" /> </form></body> handler1.ashx <%@ WebHandler Language="C#" Class="handler1" %> using System;using System.Web; public class handler1 : IHttpHandler { public void ProcessRequest (HttpContext context) { context.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; } } }http://malsup.github.com/jquery.form.js 大哥,这样报错啊 对象不支持此属性或方法我没用handler1.ashx,是直接在后台写一个[WebMedth]静态方法。 如何读取 独立存储空间里文件,并显示出来呢? ActiveX控件在网页里的大小 treenode c#写的电视直播软件 用sesson和datatable做购物车,datetable做数据源绑定datalist怎么删除datatable的一行呢, 不能接受到工作线程的消息,请教大家。 关于C#几个键盘和鼠标的API问题,请各位帮帮忙。 求一条高效的算法 mo移去图层后, 仍然不能删除文件,报告图层文件被其它进程占用,怎么办? 怎样设置打印报表时运用自己的纸张格式 关于dataview的RowFilter问题 快疯了,怎么得到一个.exe的句柄 求帮忙
<head id="Head1" runat="server">
<script src="jquery-1.7.1.min.js"></script>
<script src="jquery.form.js"></script>
<script type="text/javascript">
function upload() {
$("#form1").ajaxSubmit({
success: function (str) {
alert(str);
},
error: function (error) { alert(error); },
url: 'handler1.ashx', /*设置post提交到的页面*/
type: "post", /*设置表单以post方法提交*/
dataType: "text" /*设置返回值类型为文本*/
});
}
</script>
</head>
<body>
<form id="form1" runat="server" enctype="multipart/form-data">
<input type="file" id="file" name="file" />
<asp:Button ID="Button1" runat="server" Text="上传" OnClientClick="upload();return false;" />
</form>
</body>
handler1.ashx
<%@ WebHandler Language="C#" Class="handler1" %>
using System;
using System.Web;
public class handler1 : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.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;
}
}
}
http://malsup.github.com/jquery.form.js
大哥,这样报错啊 对象不支持此属性或方法
我没用handler1.ashx,是直接在后台写一个[WebMedth]静态方法。