兄弟我是个"卡"的收集爱好者
现在想作个站 可被无组件上传给难住了
现悬赏求一个无组件上传
要求如下:
1.index.asp页中 显示3-4个卡的缩略图 点击以后打开一个详细介绍的页面
2.管理员和会员可以上传图片并保存在某个文件中 但数据库可以记录路径
3.index.asp在数据库中调用图片
注意:
1.不是仅仅将图片上传的某个文件 而无法调用的那种
2.这个问题我已顷出所有的分 UP者无分 请谅解...
3.所提供代码符合要求者给予150分!!
这个东西思路虽然简单,可是要做完也不是一会儿就好的
网上有无组件上传类
上传这块你完成了别的就好办了
数据库里面放个图片路径,显示缩略图就自定义图片长宽
要是用PHP的话可以直接生成缩略
有EMAIL吗?我把例子发给你。
先去下一个稻香老农的那个无组件上传:
<!--#include FILE="upload_5xsoft.inc"-->
<HTML><HEAD><TITLE>图片上传系统</TITLE>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<LINK href="style.css" rel=stylesheet type="text/css">
<body bgcolor=menu style="font-size:9pt">
<%
upfolder="image/“
id=request("id")
dim upload,file,formName,formPath,iCount
set upload=new upload_5xSoft 建立上传对象
--------将日期转化成文件名--------
function MakedownName()
dim fname
fname=year(now)&right("0"&month(now),2)&right("0"&day(now),2)&right("0"&hour(now),2)&right("0"&minute(now),2)&right("0"&second(now),2)
MakedownName=fname
end function
创建工作目录
set fso=Server.CreateObject("Scripting.FileSystemObject")
FiLePaTh = server.mappath(upfolder)
If Not FSO.FolderExists(FiLePaTh) Then
Fso.Createfolder(FiLePaTh)
End If
set fso=nothing
formPath=upfolder&"/"
response.write server.mappath(formPath)
response.end
iCount=0
for each formName in upload.file 列出所有上传了的文件
set file=upload.file(formName) 生成一个文件对象
if file.FileSize>0 then 如果 FileSize > 0 说明有文件数据
IF cint(file.FileSize/1024)>=150 THEN
response.write "<script>alert(上传图片大小不得大于150K);</script>"
response.end
end if
expname=mid(file.FileName,InStrRev(file.FileName, ".")+1)
expname=trim(lcase(expname))
response.write expname
response.end
strallow=lcase("bmp,jpg,gif,png")
if expname<>"" and instr(strallow,expname)<1 then
response.write "<script>alert(上传的图片只能是jpg,gif,bmp,png中的一种!);</script>"
response.end
end if
newname=MakedownName()&"."&expname
file.SaveAs Server.mappath(formPath&newname) 保存文件
iCount=iCount+1
else
response.write "<script>alert(找不到文件);</script>"
response.end
end if
next
%>
我是把图片及介绍文字放在数据库里面,然后调用数据库记录得到相关信息,生成介绍页面,不知道满足您的要求吗?刚才忘记留我的EMAIL了,我的EMAIL是brothder@sina.com.当然还有更高级的办法,不过不满足您的有缩略图的要求。如果将图片文件存放在服务器路径下,删除记录后在删除图片的操作就会又多一层操作,所以一般情况我采用的是进入数据库的方式,当然可能在介绍过程中还有相应图片,它们则可以放到服务器的路径里。有问题可以EMAIL交流。
这里是无组件上传到服务器指定文件夹下,存其路径到数据库的代码
http://expert.csdn.net/Expert/topic/2112/2112492.xml?temp=.3666498
http://expert.csdn.net/Expert/topic/2078/2078168.xml?temp=.6322748