音乐上传和下载.doc_第1页
音乐上传和下载.doc_第2页
音乐上传和下载.doc_第3页
音乐上传和下载.doc_第4页
音乐上传和下载.doc_第5页
已阅读5页,还剩2页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

create table tb_music(id int primary key identity(1,1) not null,musicName varchar(50) not null,music varchar(50) not null)文件处理页%Set upload = Server.CreateObject(lyfUpload.UploadFile)upload.about 信息musicName = upload.request(musicName)ContentType = upload.filetype(music) music = MakeDownName()&.mp3upload.saveFile music,Server.mapPath(./music/),true,music-保存到数据库中-Set rs=Server.createObject(ADODB.Recordset)sqlstr = select * from tb_musicrs.open sqlstr,conn,1,3rs.addnewrs(musicName) = musicNamers(music) = musicrs.updaters.closeSet rs=Nothingconn.closeSet conn=Nothingresponse.write()response.write(alert(音乐添加成功!);location=addMusic.asp)response.write()%Set upload=new upload_5xsoftmusicName=upload.Form(musicName)Set file=upload.file(music)music = MakeDownName()&.&file.fileExtfile.saveAs server.mapPath(./music/&music)-保存到数据库中-Set rs=Server.createObject(ADODB.Recordset)sqlstr = select * from tb_musicrs.open sqlstr,conn,1,3rs.addnewrs(musicName) = musicNamers(music) = musicrs.updaters.closeSet rs=Nothingconn.closeSet conn=Nothingresponse.write()response.write(alert(音乐添加成功!);location=addMusic.asp)response.write()%Download.asp %Public Sub DownloadFile(strFilePath)On Error Resume Next 设置错误陷阱Response.Clear 清空缓存Server.ScriptTimeout = 999999 脚本过期时间Dim s, Fso, f, intFilelengthSet s = CreateObject(ADODB.Stream) ADO数据流对象s.Opens.Type = 1 type=1 是二进制strFilePath = Server.MapPath(strFilePath)Set Fso = CreateObject(scripting.filesystemobject)If Not Fso.FileExists(strFilePath) Thens.CloseSet s = NothingSet Fso = NothingResponse.Write alert(文件不存在);history.back()Exit SubEnd IfSet f = Fso.GetFile(strFilePath)intFilelength = f.Size 获取文件大小s.LoadFromFile (strFilePath) 文件下载If err Then err错误Response.Write (错误: & err.Description & )s.CloseSet s = NothingSet Fso = NothingExit SubEnd IfSet Fso = NothingDim DataData = s.Read 读取二进制数据s.CloseSet s = NothingIf Response.IsClientConnected ThenIf Not (InStr(LCase(f.Name), .asp) 0 Or InStr(LCase(f.Name), .js) 0) ThenResponse.AddHeader Content-Disposition, attachment; filename= & f.NameEnd IfResponse.AddHeader Content-Length, intFilelengthResponse.Charset = UTF-8Response.ContentType = application/octet-streamResponse.BinaryWrite DataResponse.FlushEnd IfEnd Sub%Javascript中的模式窗口window.showModalDialog(url,dialogHeight=200px;dialogWidth=200px);同window.open区别1.dialogHeight :对话框高度,不小于px,中dialogHeight 和 dialogWidth 默认的单位是em,而中是px,为方便其见,在定义modal方式的对话框时,用px做单位。2.dialogWidth: 对话框宽度。3.dialogLeft: 离屏幕左的距离。4.dialogTop: 离屏幕上的距离。5.center: yes | no | 1 | 0 :窗口是否居中,默认yes,但仍可以指定高度和宽度。6.help: yes | no | 1 | 0 :是否显示帮助按钮,默认yes。7.resizable: yes | no | 1 | 0 IE5+:是否可被改变大小。默认no。8.status: yes | no | 1 | 0 IE5+:是否显示状态栏。默认为yes Modeless或noModal。9.scroll: yes | no | 1 | 0 | on | off :指明对话框是否显示滚动条。默认为yes。下面几个属性是用在HTA中的,在一般的网页中一般不使用。10.dialogHide: yes | no | 1 | 0 | on | off :在打印或者打印预览时对话框是否隐藏。默认为no。11.edge: sunken | raised :指明对话框的边框样式。默认为raised。12.unadorned: yes | no | 1 | 0 | on | off :默认为no。在网页中嵌入window播放器bodymargin:0px;overflow:hidden; param name=Filename value=./music/ embed title=dvubb type=application/x-oleobject codebase=/activex/controls/mpla

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论