在FF、Chrome 下是正常的
IE下就是获取不到 Request.file 没有文件
代码如下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>后台代码 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 ";
}
IE下就是获取不到 Request.file 没有文件
代码如下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>后台代码 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 ";
}
http://topic.csdn.net/t/20061107/22/5140788.html