62,243
社区成员




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.ashx
HttpPostedFile 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 ";
}