网络编程
位置:首页>> 网络编程>> Asp编程>> asp如何在网站上提供音乐下载?

asp如何在网站上提供音乐下载?

  发布时间:2010-06-22 21:14:00 

标签:下载,音乐,asp

如何在网站上提供音乐下载?

为用户提供歌曲下载,一般有两种方式,一是直接通过Http,浏览器下载,二是通过ftp协议下载。我们来用Http和浏览器下载做一个看看:

<%
id=request(“id")
set tdb=server.createobject(“adodb.connection")
tdb.open “music"
SQL=“select mp3url from music where id ="&id
' 获得歌曲id
set tset=tdb.execute(SQL)
if tset.eof then 
response.end
else
SQL=“update music set total_down=total_down
+1 where id ="&id
tdb.execute(SQL)
downfile=tset(“url")
' 本例可在数据库中对下载次数进行跟踪记录.此语句是更新数据库中歌曲的下载次数
tdb.close
set tset=nothing
set tdb=nothing
end if
if downfile=“" or isnull(downfile) then response.end
downfile=“http://"+downfile
response.redirect(downfile)
' 下载相应歌曲
response.end
%>

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com