-
file download link
I want to make sure that when the user clicks a link to a media file it shows the save file dialog
code:
Code:
<%@ Import Namespace="System.IO"%>
<script language="VB" runat="server">
Sub Page_Load(sender As Object, e As EventArgs)
Dim root As String = "c:\dirname"
Dim filepath As String = Request.Params("file")
Response.Write(filePath)
If Not filepath Is Nothing Then
If File.Exists(filepath) And filepath.StartsWith(root) Then
Dim filename As String = Path.GetFileName(filepath)
Response.Clear()
Response.ContentType = "application/octet-stream"
Response.AddHeader("Content-Disposition", _
"attachment; filename=""" & filename & """")
Response.Flush()
Response.WriteFile(filepath)
End If
End If
End Sub
</script>
but when the user gets the dialog it doesnt tell the user how big the file is.
How can i get it to show how big the file is?
-
Response.AddHeader "Content-Length", FileSize