how to open a file from server

Last post 07-07-2008 11:10 PM by Thomas Sun – MSFT. 3 replies.

Sort Posts:

  • how to open a file from server

    07-03-2008, 7:31 AM
    • Loading...
    • ramesh.sri
    • Joined on 04-09-2008, 2:08 PM
    • Posts 19
     Hi I have one requirement  I am uploading a file in server successfully, After uploading file I need to show preview, so when we click on preview I need to open .doc or .txt file  Please Suggest me if you  have any ideas  Thanks

    Ramesh

     

  • Re: how to open a file from server

    07-03-2008, 8:26 AM
    Answer

    Just give a link which points to this file, with virtual path

    Vikram
    www.vikramlakhotia.com
    justlikethat.vikramlakhotia

    Please mark the answer if it helped you
  • Re: how to open a file from server

    07-03-2008, 10:16 AM
    • Loading...
    • ramesh.sri
    • Joined on 04-09-2008, 2:08 PM
    • Posts 19

    Hi

     I did not get Plz explain me clearly

    I am uploading image, image successfully i am display image after click on priview

    code i have return is i taken  image url in aspx page in .vb page i return

    Image1.ImageUrl = Server.MapPath("~/temp/" & Session("filename")) like that iam display image when i click on privew

     if i upload .doc or .txt file what i have to give please tell me

     

    Thanks

    Ramesh

     

     

     

  • Re: how to open a file from server

    07-07-2008, 11:10 PM
    Answer

    Hi,

    If you want to preview the .doc or .txt file, the server will write these files to client.

    You can use HyperLink to point to the file. For example, you can set the NavigateUrl in the code behind:

     <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/UploadFile/FileName.doc">Preview</asp:HyperLink>

    You also can write the file to client for preview using Response.BinaryWrite method. For more information, see http://www.codeproject.com/KB/aspnet/textfile.aspx

     

    I hope this helps.

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Page 1 of 1 (4 items)
Microsoft Communities
Page view counter