〈INPUT type="hidden" name="server1"〉 〈input type="hidden" name="mysession" value="mysession"〉 〈/form〉 ########## news_updating.asp 〈!--#include file="news_session.asp"--〉 〈!--#include file="upload.inc"--〉 〈% 'Fields("xxx").Name 取得Form中xxx(Form Object)的名字 'Fields("xxx").FilePath 如果是file Object 取得文件的完整路径 'Fields("xxx").FileName 如果是file Object 取得文件名 'Fields("xxx").ContentType 如果是file Object 取得文件的类型 'Fields("xxx").Length 取得Form中xxx(Form Object)的数据长度 'Fields("xxx").Value 取得Form中xxx(Form Object)的数据内容 Dim FormData,FormSize,gnote,bnote,notes,binlen,binstr FormSize=Request.TotalBytes FormData=Request.BinaryRead(FormSize) Set Fields = GetUpload(FormData) '############判断输入错误 dim mytitle,content,src,id,mysession mysession=Fields("newtitle").value if len(mysession)=0 then Response.Write "非法登陆或超时间,请重新登陆" Response.End end if mytitle=Fields("newtitle").value mytitle=replace(mytitle,"","") mytitle=replace(mytitle,"〈br〉","") content=Fields("newcontent").value src=Fields("newssrc").value src=replace(src,"","") src=replace(src,"〈br〉","") id=trim(right(Fields("myid").value,12)) if len(mytitle)=0 then Response.Write "〈script〉" Response.Write "alert('出错!新闻标题不能为空!');" Response.Write"location.href=history.go(-1);" Response.Write "〈/script〉" end if if len(content)=0 then Response.Write "〈script〉" Response.Write "alert('出错!新闻内容不能为空!');" Response.Write"location.href=history.go(-1);" Response.Write "〈/script〉" end if if len(src)=0 then Response.Write "〈script〉" Response.Write "alert('出错!新闻来源不能为空!');" Response.Write"location.href=history.go(-1);" Response.Write "〈/script〉" end if
'############################################################################################图片更该功能的实现 newfile="client1" If Fields(newfile).FileName〈〉"" Then set file_0=Server.CreateObject("Scripting.FileSystemObject") dim contextname contextname=right(Fields("client1").FileName,4) imageid=id&contextname if contextname〈〉".gif" and contextname〈〉".jpg" then '#########判断上传文件格式 Response.Write "〈script〉" Response.Write "alert('出错!上传文件格式不对 只能为jpg/gif图片格式!');" Response.Write"location.href=history.go(-1);" Response.Write "〈/script〉" end if file_name=Server.MapPath("./images/"&imageid&"") '#####################################如果原来有图片文件主名为id的则删除该图片 if file_0.fileexists(server.MapPath ("./images/"&id&".gif")) then