Export A File and Delete it from Server

Private Sub DownloadFile()
        Response.ContentType = ContentType
        Response.AppendHeader("Content-Disposition", _
                              "attachment; filename=myFile.txt")
        Response.WriteFile(Server.MapPath("~/uploads/myFile.txt"))
        Response.Flush()
        System.IO.File.Delete(Server.MapPath("~/uploads/myFile.txt"))
        Response.End()
End Sub

No comments:

Post a Comment