filepath="Emailannex/"
for each formName in upload.File
set file=upload.File(formName)
if file.filesize>10 then
fileExt=lcase(file.FileExt) '得到的文件扩展名不含有.
if fileext<>"doc" and fileext<>"txt" then
fileExt="gif"
response.write "<script language=javascript>alert('只能上传DOC、txt格式的文件!');history.go(-1);</script>"
response.end
end if
if file.filesize>(10000*1024) then
response.write "<script language=javascript>alert('文件大小不能超过10M!');history.go(-1);</script>"
response.end
end if
我将这上面的TXT改为了RAR,运行出现如下错误
ADODB.Stream 错误 '800a0bbc'
写入文件失败。
D:\WWWROOT\OA\HXPERSONALOFFICE\../HXINCLUDE/HX_photo.asp,行 151
然后HX_photo.asp相关代码段如下(加粗为151行):
'保存文件方法
Public function SaveToFile(FullPath)
dim oFileStream,ErrorChar,i
SaveToFile=1
if trim(fullpath)="" or right(fullpath,1)="/" then exit function
set oFileStream=CreateObject("Adodb.Stream")
oFileStream.Type=1
oFileStream.Mode=3
oFileStream.Open
oUpFileStream.position=FileStart
oUpFileStream.copyto oFileStream,FileSize
oFileStream.SaveToFile FullPath,2
oFileStream.Close
set oFileStream=nothing
SaveToFile=0
end function
End Class