本来以为是IE设置问题,但别人也用了类似的代码却没问题,调试过程也没啥问题,就显示时错了,实在不知道问题出在哪,求助啊!!!另外,我的提交页面是静态页面
代码如下
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<form id="form1" action="Handler2.ashx" method="post" enctype="multipart/form-data">
<input type="file" id="upfile" name="upfile" />
<input type="submit" />
</form>
</body>
</html>
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/html";
context.Response.Write("{123412312}");
}
------解决方案--------------------------------------------------------
这个和浏览器应该关系不大吧?lz把服务端的代码改为:
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/html";
HttpPostedFile file1 = context.Request.Files["upfile"];
if (file1 != null && string.IsNullOrEmpty(file1.FileName) == false)
context.Response.Write(file1.FileName);
else
context.Response.Write("{123412312}");
}
就没有这个问题了