社区
C#
帖子详情
求一段C# jquery上传图片的代码。
lixia2229
2012-03-31 11:58:07
RTRTRTRTRTRTRTR
...全文
155
4
打赏
收藏
求一段C# jquery上传图片的代码。
RTRTRTRTRTRTRTR
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
4 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
lixia2229
2012-04-03
打赏
举报
回复
[Quote=引用 1 楼 的回复:]
<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"……
[/Quote]
大哥,这样报错啊 对象不支持此属性或方法
我没用handler1.ashx,是直接在后台写一个[WebMedth]静态方法。
孟子E章
2012-04-03
打赏
举报
回复
不能使用WebMedth方法
孟子E章
2012-03-31
打赏
举报
回复
<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
苹果哥
2012-03-31
打赏
举报
回复
[Quote=引用 1 楼 的回复:]
<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……
[/Quote]
大神已经回复
C#
多张图片上传
C#
多张图片上传
环境:vs2010 Web项目 实现多张图片上传
asp.net+
jquery
.uploadify文件上传(异步上传)
采用
jquery
.uploadify插件作为前台上传,服务台用
c#
异步处理
jquery
文件上传插件
jquery
.uploadify.js
jquery
文件上传插件
jquery
.uploadify.js 不支持IE10现在经过修改,已经支持IE6、IE7、IE8、IE9、IE10、IE11.zip
ASP.NET(
C#
)实现一次性上传多张图片
ASP.NET(
C#
)实现一次性上传多张图片(或文件),比较简单,适合初学者哦
jQuery
Multiple File Upload Plugin+asp.net(
c#
)实现多文件上传
利用
jQuery
Multiple File Upload Plugin插件,实现的多文件上传,
C#
111,126
社区成员
642,540
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章