我常用的一个组件就是LyfUpload
示例如下:
set obj=server.createobject("LyfUpload.UploadFile")
obj.extname="jpg,gif" '限制扩展名
obj.maxsize=102400 '限制文件大小
...
image=obj.request("image")
Randomize
no = Int(999999*Rnd+1)
img1=year(date())&month(date())&day(date())&no&".jpg"'重命名
ss=obj.SaveFile("image", DBQ, true,img1) '保存文件到服务器
if ss= "" then
Response.Write "文件上传失败!"
response.write "
返回,重新上传"
elseif ss= "0" then
Response.Write "文件尺寸过大!"
response.write "
返回,重新上传"
elseif ss= "1" then
Response.Write "文件不是gif/jpg文件!"
response.write "
返回,重新上传"
else
Response.Write "文件上传成功!"
end if