用ASPNET怎么寫(xiě)文件上傳和下載的代碼啊?
string fileURL = this.Server.MapPath("你要下載的文件路徑")
;//文件路徑,可用相對(duì)路徑FileInfo fileInfo = new FileInfo(fileURL)
;Response.Clear()
;Response.AddHeader("content-disposition", "attachment;filename=" + Server.UrlEncode(fileInfo.Name.ToString()))
;//文件名Response.AddHeader("content-length", fileInfo.Length.ToString())
;//文件大小Response.ContentType = "application/octet-stream"
;Response.ContentEncoding = System.Text.Encoding.Default;Response.WriteFile(fileURL);