0

hey i am trying to develop a mock website and in this i want to upload a word file which users can download or just open using "open" "save" or Cancel button on the dialog box. Please if any one could help me with the code.
Thank you.

1
Contributor
1
Reply
2
Views
9 Years
Discussion Span
Last Post by hiralmehta
0

I got the solution for my problem if any one who is facing this can use it. it worked for me

Dim filePath As String = System.IO.Path.GetFullPath("C:\inetpub\wwwroot\hiralfinalcv2.doc")
    Dim targetFile As System.IO.FileInfo = New System.IO.FileInfo(filePath)
    Dim objFileInfo As FileInfo
Try

            objFileInfo = New FileInfo(filePath)

            Response.Clear()

            Response.Cache.SetCacheability(System.Web.HttpCacheability.Private)

            Response.AddHeader("Content-Disposition", "attachment; filename=" & objFileInfo.Name)

            Response.AddHeader("Content-Length", objFileInfo.Length.ToString())

            Response.ContentType = "application/octet-stream"
            Response.WriteFile(filePath)
            Response.End()
        Catch ex As Exception
            'MsgBox("error")
        End Try
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.