在FF、Chrome 下是正常的
IE下就是获取不到 Request.file 没有文件
代码如下
- JScript code
JS function people_modif() { var vURL = "admin_action.ashx?&rand=" + Math.random(); $("#peopledetail").ajaxSubmit({ url:encodeURI(vURL), type: "post", dataType: "text", success: function (str) { }, error: function (error) { } }); }HTML:<div style=" float:left">更新图片:<input id="popmodifimage" type="file" name="popmodifimage" /></div>
- C# code
后台代码 action.ashxHttpPostedFile pf = Request.Files["popmodifimage"];if (pf != null){ string fileExtension = System.IO.Path.GetExtension(pf.FileName); //上传文件的扩展名 if (fileExtension != ".jpg" && fileExtension != ".gif" && fileExtension != ".bmp" && fileExtension != "png") { Response.Write("-1"); return; } fileName = DateTime.Now.ToString("yyyyMMddHHmmss") + fileExtension; //给文件重新命名 pf.SaveAs(path + fileName); if (mpopimgurl != "") File.Delete(path + mpopimgurl); strimg = " ,ImageUrl=@imageurl ";}
------解决方案--------------------------------------------------------
你不如采用提交到隐藏的iframe来的兼容性好,没有必要采用这些框架来实现。况且,这些框架的实现是有Bug的。
------解决方案--------------------------------------------------------
form要设置成multipart/formdata才能上传文件
------解决方案--------------------------------------------------------
var vURL = "admin_action.ashx?&rand=" + Math.random()
------解决方案--------------------------------------------------------
楼主搜下 iframe上传,有很多信息的
参考下
http://topic.csdn.net/t/20061107/22/5140788