图片上传程序(无组件,能上传成功) 怎样在第二页获得路径?
<%'dim fileformat
'fileformat=mid(file.FileName,InStrRev(file.FileName, ".")+1)
'if fileformat<>"gif" or fileformat<>"jpg" or fileformat<>"png" or fileformat<>"jpeg" or fileformat<>"bmp" or fileformat<>"swf" then
'response.write "<Script>alert('您上传的文件是不符合格式的的文件!\n支持上传的文件格式有:*.gif、*.jpg、*.jpeg、*.png、*.bmp、*.swf');history.back()</Script>"
'response.end
'end if
dim upload,file,formName,formPath,iCount
set upload=new upload_F
function MakedownName()
dim fname
fname = now()
fname = replace(fname,"-","")
fname = replace(fname," ","")
fname = replace(fname,":","")
fname = replace(fname,"PM","")
fname = replace(fname,"AM","")
fname = replace(fname,"上午","")
fname = replace(fname,"下午","")
fname = int(fname) + int((10-1+1)*Rnd + 1)
MakedownName=fname
end function
formPath="inc/"
iCount=0
for each formName in upload.file ''列出所有上传了的文件
set file=upload.file(formName) ''生成一个文件对象
if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
newname=MakedownName()&"."&mid(file.FileName,InStrRev(file.FileName, ".")+1)
file.SaveAs Server.mappath(formPath&newname) ''保存文件
iCount=iCount+1
'Response.Write ("<script language='javascript'>alert('上传成功');</script>")
response.Write "fd"
else
response.write "未找到文件 ??<A HREF=javascript:history.back(1)>返回</A>"
response.end
end if
next
%> 这是处理页面的代码~ 能上传成功,可我想用它的路径里,不知道那个是?? 大家看看~~ 帮下忙
下面是Upload.inc文件, 下载后解压下!~
[[it] 本帖最后由 lijiong520 于 2008-4-3 16:11 编辑 [/it]]
upload.rar
(1.86 KB)