帮改段上传图片的代码啊!小弟不行了

来源:百度知道 编辑:UC知道 时间:2024/06/17 10:19:23
帮改段上传图片的代码啊!小弟不行了
代码片段
<%
dim upload,file,formName,iCount
set upload=new upload_5xSoft ''建立上传对象

''在目录后加(/)
if right(formPath,1)<>"/" then formPath=formPath&"/"

iCount=0

for each formName in upload.file ''列出所有上传了的文件
set file=upload.file(formName) ''生成一个文件对象

if file.filesize=0 then
HtmEnd "请选择你要上传的文件。"
set upload=nothing
response.end
end if

if file.filesize>cint(uploadsize)*1024 then
HtmEnd "文件大小超过了限制。"
set upload=nothing
response.end
end if

if Instr(FileType,GetExtendName(file.FileName)) then
else
HtmEnd "文件格式不符合要求。"
set upload=nothing
response.end
end if

dim file_system,sub_files,cur_folder,each_file
set file_system=createobject("scripting.filesystemobject")
set cur_folder=file_s

response.write "<b>请将这个地址粘贴到“图片地址”栏:</b>http://ig.hzoko.com/up/logo/"&file.FileName" "
最后的" "去掉

改为:

response.write "<b>请将这个地址粘贴到'图片地址'栏:</b>http://ig.hzoko.com/up/logo/" & file.FileName

你没有过滤,好象可以上ASP木马.
最好添加一个Include 文件,然后在里面设置只能上传
.gif .jpg .bmp 的格式,这样就安全了 .