文件上传的问题
<FORM METHOD=POST ACTION= "a.asp " enctype= "multipart/form-data ">
标题: <input type=text value=1 name=id >
<INPUT TYPE= "file " NAME= "file " size= "20 ">
<INPUT TYPE= "submit " value= "上传 ">
</FORM>
把文件保存到服务器指定的目录下
然后保存 上传后的路径,和文本框的值到数据库中。
大家帮帮忙啊,从网上下的代码,运行都有问题啊。
------解决方案--------------------上传页
<form action= "topimg.asp?ac=add1 " method= "post " enctype= "multipart/form-data " name= "form1 " id= "form1 ">
<table width= "500 " border= "0 " align= "center " cellpadding= "4 " cellspacing= "1 ">
<tr>
<td height= "30 " colspan= "2 "> <span class= "STYLE1 "> >>添加显示图片 </span> </td>
</tr>
<tr>
<td width= "80 " align= "right "> 图片名称: </td>
<td width= "401 "> <input name= "imgname " type= "text " id= "imgname " /> </td>
</tr>
<tr>
<td align= "right "> 相关图片: </td>
<td> <input name= "img " type= "file " id= "img " /> </td>
</tr>
<tr>
<td colspan= "2 " align= "center "> <input type= "submit " name= "Submit " value= "确认添加 " />
<input type= "reset " name= "Submit2 " value= "复位重填 " /> </td>
</tr>
</table>
</form>
获取上传页:
<%
server.ScriptTimeout=20000
dim frm2
set frm2=New UpLoadClass
frm2.MaxSize =204800
frm2.FileType = "gif/jpg "
frm2.SavePath = "../images/adv/ "
frm2.AutoSave = 0
frm2.open
img=frm2.form( "img ")
imgname=frm2.form( "imgname ")
set rs=server.createobject( "adodb.recordset ")
sql= "select * from topimg "
rs.open sql,conn,1,3
rs.addnew
rs( "img ")=img
rs( "imgname ")=imgname
rs.update
rs.close
set rs=nothing
%>
<script language= "javascript " type= "text/javascript ">
alert( "添加成功! ")
location.href= "topimg.asp "
</script>
无具类上传组件
UpLoadClass.asp
------解决方案--------------------搜索upload_5xsoft.inc无组件上传类,很好用。
------解决方案--------------------给你个实例。。。
www.kudaa.com/downlist.asp
------解决方案--------------------化境上传,搜索,我的都行
------解决方案--------------------那可能是你的上传路径有问题。
------解决方案--------------------运行一下regsvr32 scrrun.dll试试吧。
------解决方案-------------------- <?xml version= "1.0 " encoding= "utf-8 "?>
<package>
<?component error= "false " debug= "false "?>