无组件上传图片问题

来源:百度知道 编辑:UC知道 时间:2024/05/25 00:04:35
我现在用无组件可以上传到文件夹了,但是想把生成的 文件名或路径上传到 数据库中记录。但不知道在哪改才能链接到我 建立的表和字段。
我 用的那个 一共3个文件,UPFILE.asp,uplaod.asp和 uplaod.ini
以下是uplaod.asp代码。

<!--#include file="upload.inc"-->
<!--#include file="conn.asp"-->

<html>
<head>
<title>文件上传</title>
</head>
<body topmargin=0>
<%
dim upload,file,formName,formPath,iCount,filename,fileExt
set upload=new upload_5xSoft ''建立上传对象

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

response.write "<body>"

iCount=0
for each formName in upload.file ''列出所有上传了的文件
set file=upload.file(formName) ''生成一个文件对象
if file.filesize<100 then
response.write "请选择你要上传的文件 [ <a href=# onclick=history.go(-1)>重新上传</a>
<

给你个我的收藏 看这里!
只有一个文件的上传系统,可以返回文件名(可选择按日期还是原文件名)
http://marcho.cn/POST/2008-3-30-1.shtml
有不明白的QQ:303302
参考资料:www.marcho.cn

if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
file.SaveAs Server.mappath(FileName) ''保存文件
for i=0 to ubound(Forumupload)
if fileEXT="."&trim(Forumupload(i)) then
response.write "<script>parent.frm1.txt1.value=parent.frm1.txt1.value+'/"&FileName&"'</script>"
// 插在这里
dim sql
sql = "insert into teacher(tec_pic) values("&filename&")"
conn.ExeCute(sql)

exit for
end if
next
iCount=iCount+1