87,907
社区成员
发帖
与我相关
我的任务
分享
<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");
}
}