就得使用无组件上传程序了呀
还是挺方便的
给你一个例子,其中upload.inc就是无组件上传程序,很多地方有下载的
新闻增加<%
dim upload,file,formName,formPath,iCount,filename,fileExt
set upload=new upload_5xSoft ''建立上传对象
'########## 设定上传图片保存路径 ####################
formPath="../newsimages"
''在目录后加(/)
if right(formPath,1)<>"/" then formPath=formPath&"/"
newsclass=trim(upload.form("newsclass"))
title=changechr(trim(upload.form("title")))
content=htmlencode(trim(upload.form("content")))
istop=upload.form("istop")
newsid=upload.form("newsid")
if upload.form("isimg")="yes" then
for each formName in upload.file ''列出所有上传了的文件
set file=upload.file(formname) ''生成一个文件对象
if file.filesize<10 then
response.write "
请先选择你要上传的图片 [ 重新上传 ]"
response.end
end if
if file.filesize>50000 then
response.write "
图片大小超过了限制 [ 重新上传 ]"
response.end
end if
fileExt=lcase(right(file.filename,4))
if fileEXT<>".gif" and fileEXT<>".jpg" then
response.write "
文件格式不对,只支持jpg、gif文件 [ 重新上传 ]"
response.end
end if
filename=formPath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&file.FileName
if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
file.SaveAs Server.mappath(filename) ''保存文件
end if
set file=nothing
set upload=nothing ''删除此对象
next
end if
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from newslist where newsid is null"
rs.open sql,objconn,1,3
rs.addnew
rs("title")=title
rs("content")=content
rs("istop")=istop
rs("newsclass")=newsclass
rs("adddate")=date()
if filename<>"" then
filename=replace(filename,"../newsimages/","")
rs("newsimg")=filename
end if
rs.update
rs.close
set rs=nothing
response.write ""
%>