filepath = " /music/2006522133342.mp3 " filepath = server.mappath(filepath) Response.buffer = True ' 开启缓存 Response.ContentType = " audio/x-pn-realaudio " ‘文件类型 Dim objStream Set objStream = Server.CreateObject( " ADODB.Stream " ) ' 创建ADODB.stream对象 objStream.Type = 1 ' 以二进制读取模式 objStream.Open objStream.LoadFromFile filepath ' 读取文件 Response.binarywrite objStream.Read ' 以二进制的方式输出至客户端浏览器 response.Flush() ' 边缓存边输出 Session( " afon " ) = false ' 重新设置session为FALSE objStream.Close Set objStream = Nothing 附常见的contenttype类型 < % Function Get_FileTypeAbName(sFileType) select case sFileType ' 图像类 Case " image/gif " Get_FileTypeAbName = " gif " exit function Case " image/pjpeg " Get_FileTypeAbName = " jpg " exit Function Case " image/bmp " Get_FileTypeAbName = " bmp " exit Function Case " image/png " Get_FileTypeAbName = " png " exit Function Case " image/tif " Get_FileTypeAbName = " tif " Exit Function ' 音频类 Case " audio/mpeg " Get_FileTypeAbName = " mp3 " Exit Function Case " audio/x-ms-wma " Get_FileTypeAbName = " wma " Exit Function Case " audio/mid " Get_FileTypeAbName = " mid " Exit Function Case " audio/wav " Get_FileTypeAbName = " wav " Exit Function ' 视频类 Case " application/vnd.rn-real media " Get_FileTypeAbName = " rm " Exit Function Case " video/x-ms-wmv " Get_FileTypeAbName = " wmv " Exit Function ' flash Case " application/x-shockwave-flash " Get_FileTypeAbName = " swf " Exit Function ' 压缩软件类 Case " application/x-zip-compressed " Get_FileTypeAbName = " zip " Exit Function Case " application/octet-stream " Get_FileTypeAbName = " rar " Exit Function ' 文本类 Case " text/plain " Get_FileTypeAbName = " txt " Exit Function Case " text/html " Get_FileTypeAbName = " html " Exit Function Case " application/msaccess " Get_FileTypeAbName = " mdb " Exit Function Case " application/msword " Get_FileTypeAbName = " doc " Exit Function Case " application/vnd.ms-excel " Get_FileTypeAbName = " xls " Exit Function end select End Function % >