Hi,
File Upload
If FileUpload1.PostedFile.ContentLength > 0 Then
Dim file As String = Server.MapPath("UploadedFiles/" & PostedFile.FileName);
FileUpload1.SaveAs(file);
End If
File Download
Public Shared Sub DownloadFile(FileName As String)
If File.Exists(FileName) Then
Dim strFileName As String = Path.GetFileName(FileName).Replace(" ", "%20")
HttpContext.Current.Response.ContentType = "application/octet-stream"
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" & strFileName)
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.WriteFile(FileName)
HttpContext.Current.Response.[End]()
End If
End Sub
Thanks,
Imadhusen