我使用无惧无组件上传,要求把路径存入表中,现在有一个页面
<!-------sc.asp------>
============================================================
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 " />
<title> 无标题文档 </title>
</head>
<body>
<form method= "post " action= "tijiao.asp " name= "form1 ">
照片名称: <input type= "text " /> <br />
路径: <input type= "file " /> <br />
<input type= "submit " value= "提交 " />
</form>
</body>
</html>
=================================================
access数据库表img列名name,lj,帮我便一个 tijiao.asp的代码,要求把文件名存入列name中,把路径存入lj中,使用的是无惧无组件上传,使其他的上传类也行,只要能成功上传就给分,conn不用编写了,谢谢各位!!
------解决方案--------------------
使 用 示 例
上传文件的表单要加入enctype= "multipart/form-data "属性,即
<form name= "form1 " method= "post " action= " " enctype= "multipart/form-data ">
<input type= "text " value= "1 " name= "name ">
<input type=file name= "img ">
<input type=submit name= "submit " value= "提交 ">
</form>
在执行上传的ASP页
'包含类文件
<!-- #include file= "upfile_class.asp " -->
dim upfile
dim SaveFilename
'建立上传对象
set upfile=new upfile_class
'取得上传数据,限制最大上传10M 计算方法为 10240000/1000000=10.24M
upfile.GetData (10240000)
'判决是否出错
if upfile.isErr then
select case upfile.err
case 1
Response.Write "你没有上传数据呀???是不是搞错了?? "
case 2
Response.Write "你上传的文件超出我们的限制,最大10M "
end select
else
'执行保存文件代码
upfile.SaveToFile "img ", "c:\ "&upfile.file( "img ").filename
'执行自动保存文件代码,SaveFilename为保存的文件名
SaveFilename=upfile.AutoSave( "img ", "c:\ ")
'销毁对像
set upfile=nothing
end if
------解决方案--------------------
<form method= "post " action= "tijiao.asp " name= "form1 " ENCTYPE= "multipart/form-data ">
照片名称: <input type= "text " name= "name " /> <br />
路径: <input type= "file " name= "file " /> <br />
</form>
tijiao.asp
<!--#include file= "xxx.asp "-->
<%
.......
name = upload.form( "name ")
file = upload.files( "file ")
cn.execute( "insert into img([name],lj) values( ' " & name & " ', ' " & file.NewFileName & " ') ")
' 注:file.NewFileName 根据使用的组件或类不同,有所不同,请自行查阅
%>
------解决方案--------------------
http://blog.programfan.com/article.asp?id=26213
http://blog.csdn.net/snlixing/archive/2007/04/18/1568763.aspx
试试