日期:2014-05-17  浏览次数:20919 次

这个路径该怎么写?文件能直接下下来
我的路径在I盘这个映射盘里,找到 <%=rs_word( "QQNo ")%> .pcm这个文件,点击后就自动下载
<a   href=file:\\\\I\\ <%=rs_word( "QQNo ")%> .pcm> 点这里收听 </a>
我每次试都找不到服务器...
那应该怎样写呢?help!!!

------解决方案--------------------
<A href= "down.asp?ID=10 "> down </a>
down.asp
<!--#include file= "conn.asp "-->
<%
ID=CLNG(ID)
dim Dname
Dname=cONN.eXECUTE( "select downurl from downloads where ID= "&ID)(0)
Response.Buffer = true
Response.Clear
dim url
Dim fso,fl,flsize
Dim objStream,ContentType,flName,isre,url1

If Dname <> " " Then
url=server.MapPath( ". "& "\ "&Dname)
'Response.Write Url
End If

Set fso=Server.CreateObject( "Scripting.FileSystemObject ")
Set fl=fso.getfile(url)
flsize=fl.size
flName=fl.name
Set fl=Nothing
Set fso=Nothing

Set objStream = Server.CreateObject( "ADODB.Stream ")
objStream.Open
objStream.Type = 1
objStream.LoadFromFile url


Select Case lcase(Right(flName, 4))
Case ".asf "
ContentType = "video/x-ms-asf "
Case ".avi "
ContentType = "video/avi "
Case ".doc "
ContentType = "application/msword "
Case ".zip "
ContentType = "application/zip "
Case ".xls "
ContentType = "application/vnd.ms-Excel "
Case ".gif "
ContentType = "image/gif "
Case ".jpg ", "jpeg "
ContentType = "image/jpeg "
Case ".wav "
ContentType = "audio/wav "
Case ".mp3 "
ContentType = "audio/mpeg3 "
Case ".mpg ", "mpeg "
ContentType = "video/mpeg "
Case ".rtf "
ContentType = "application/rtf "
Case ".htm ", "html "
ContentType = "text/html "
Case ".txt "
ContentType = "text/plain "
Case Else
ContentType = "application/octet-stream "
End Select


Response.Buffer=True
Response.Clear
Response.AddHeader "Content-Disposition ", "attachment; filename= " & flName
Response.AddHeader "Content-Length ", flsize

Response.Charset = "UTF-8 "
Response.ContentType = ContentType

Response.BinaryWrite objStream.Read
Response.Flush
response.Clear()
objStream.Close
Set objStream = Nothing

%>
------解决方案--------------------
关注
------解决方案--------------------
你的是本地目录啊,如果是网站使用,你必须提供以你的网站地址为标准的URI地址啊。