if Request.TotalBytes >409600 then
Request.BinaryRead Request.TotalBytes
Response.Clear
Response.Write "您选择的图片超过了400K,上传失败。请重新上传。"
Response.End
end if
%>
if flag(0)="" or flag(1)="" then
Response.Write "参数不全,保存数据失败!"
Response.End
end if
photoid=split(flag(0),"=")
smallpic=split(flag(1),"=")
bigpic=split(flag(2),"=")
'/****************图片上传*********************/
Set ObjUpload = Server.CreateObject("UploadPhoto.clsUpload")
ObjUpload.sFilterString=".jpg;.bmp;.gif"
lFileLen=ObjUpload.DoUpload(smallpicphy)
tempFileName=trim(ObjUpload.sFileNewName)
set ObjUpload=nothing
if lFileLen=0 then
%>
alert("文件上载出错,请重试!");
window.history.back();
Response.End
end if
Application.Lock
'删除旧目标文件
Set FileObject = Server.CreateObject("Scripting.FileSystemObject")
if trim(smallpic(1))"" and fileobject.FileExists(smallpicphy&trim(smallpic(1))) then
InStream=FileObject.DeleteFile (smallpicphy&smallpic(1),1)
end if
set fileobject=nothing
'更新数据库记录
sql="update news2_photo set smallpic='" &tempFileName & "' where photoid='" & photoid(1) & "'"
conn.execute sql
Application.UnLock%>
alert("保存成功!");