dwz的uploadify怎么获取是否上传成功?

7年 2014-09-29 04:40:10
引用了jquery.uploadify.min.js(最新版本),后台写了方法,现在文件可以正常上传。可是怎么获取是否上传成功?
需要重写onUploadSuccess?

<dl>
<dt>文件上传:</dt>
<dd class="uploadify" data-title="选择培训资料" data-maxsize="2000" data-uploadlimit="3">
<input type="file" name="uploadify" id="uploadify" />
<div class="button">
<div class="buttonContent">
<button class="upload">
上传</button>
</div>
</div>
<div class="button">
<div class="buttonContent">
<button class="cancel">
取消</button>
</div>
</div>
</dd>
</dl>


public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
context.Response.Charset = "utf-8";

HttpPostedFile file = context.Request.Files["Filedata"];
string uploadPath = HttpContext.Current.Server.MapPath(@"/R/upload/");

if (file != null)
{
if (!Directory.Exists(uploadPath))
{
Directory.CreateDirectory(uploadPath);
}
file.SaveAs(uploadPath + file.FileName);
//下面这句代码缺少的话,上传成功后上传队列的显示不会自动消失
context.Response.Write("1");
}
else
{
context.Response.Write("0");
}
}
...全文
172 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
7年 2014-09-30
  • 打赏
  • 举报
回复
又有个新问题,HttpPostedFile file = context.Request.Files["Filedata"]; 一直是null这是为什么啊
7年 2014-09-29
  • 打赏
  • 举报
回复
嗯,谢谢楼上。我知道啦!
webzxl 2014-09-29
  • 打赏
  • 举报
回复
重写'onUploadSuccess'方法,示例如下: 'onUploadSuccess': function (file, data, response) { //其中通过data和response,可以判断是否成功.data为后台返回参数。 }

87,907

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧