各位紧急求教!!!
<!--#include FILE= "upload.inc "-->
<!--#include file= "conn.asp " -->
<html>
<head>
<title> 文件上传 </title>
</head>
<body>
<%
dim upload,file,formName,formPath,iCount,filename
set upload=new upload_5xsoft ' '建立上传对象
formPath=upload.form( "filepath ")
' '在目录后加(/)
if right(formPath,1) <> "/ " then formPath=formPath& "/ "
iCount=0
for each formName in upload.file ' '列出所有上传了的文件
set file=upload.file(formName) ' '生成一个文件对象
filename=file.FileName
if file.FileSize> 0 then ' '如果 FileSize > 0 说明有文件数据
file.SaveAs Server.mappath( "uploading/ "&filename) ' '保存文件
response.write file.FilePath&filename& " => "&formPath&filename& " 成功! <br> "
iCount=iCount+1
end if
set file=nothing
next
set upload=nothing ' '删除此对象
Htmend iCount& " 个文件上传结束! "
sub HtmEnd(Msg)
set upload=nothing
set rs=server.createobject( "adodb.recordset ")
sql= "insert into ptime (photo,uresume) values( ' "&filename& " ', ' "&filename& " ') "
'这个地方怎么写啊!!!!!????
set rs=conn.execute(sql)
set rs=nothing
end sub
response.write "上传成功,[ <a href=# onclick=history.go(-1)> 返回 </a> ] "
%>
</body>
</html>
我要上传两个文件,请问怎样可以将两个文件的路径保存到数据库中.急啊!!!!
------解决方案--------------------建立一个变量:
<%
Dim strPath
...
for each formName in upload.file ' '列出所有上传了的文件
set file=upload.file(formName) ' '生成一个文件对象
filename=file.FileName
if file.FileSize> 0 then ' '如果 FileSize > 0 说明有文件数据
file.SaveAs Server.mappath( "uploading/ "&filename) ' '保存文件
response.write file.FilePath&filename& " => "&formPath&filename& " 成功! <br> "
iCount=iCount+1
if strPath = " " then
strPath = filename
else
strPath = strPath & "| " & filename
end if
end if
set file=nothing
next
...
sql= "insert into ptime (photo,uresume) values( ' "&filename& " ', ' "&strPath& " ') "
%>
------解决方案--------------------Server.mappath( "uploading/ "&filename)
//你保存到哪里你就加个隐藏表单传值就好了!
------解决方案--------------------不会写SQL语句吗?
formPath=upload.form( "filepath ")
sql= "insert into ptime (photo,uresume) values( ' "&strPath& " ', ' "&filename& " ') "
就行了