87,910
社区成员
发帖
与我相关
我的任务
分享
Ext.onReady(function () {
Ext.create("Ext.form.FormPanel", {
width: 400,
renderTo: "test",
fileUpload: true,
items: [{
xtype: "fileuploadfield",
id: "Q_Annex",
name: "Q_Annex",
fieldLabel: "上传"
}],
buttons: [{
text: "上传",
handler: function () {
Ext.Ajax.request({
url: "Ajax/AnnexHandler.ashx",
success: function (response) {
alert(response.responseText);
}
})
}
}]
});
})
public class AnnexHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
try
{
HttpFileCollection fileCollect = context.Request.Files;
if (fileCollect.Count > 0)
{
context.Response.Write("success");
}
else
{
context.Response.Write("failure");
}
}
catch(){ }
}
}