How to view the uploaded word file in browser?

Posted by Prabu_Spark under ASP.NET on 4/25/2013 | Points: 10 | Views : 1397 | Status : [Member] | Replies : 1
Hi sir,
Tell me the steps to view the uploaded word file in browser. I have successfully uploaded the word file in the application folder, but i cant able
to view the uploaded word file in browser. Kindly give me the solution for this problem. I attached the code below for your reference.

(Note: In naukri website, if i uploaded word file like resume it is displaying in browser, like that i need]

Default.aspx:
*******************
<asp:Label ID="Label1" runat="server" Text="Please select the file to upload"></asp:Label>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Upload" onclick="Button1_Click" />


Default.aspx.cs:
******************

protected void Button1_Click(object sender, EventArgs e)
{
Response.ContentType = "Application/msword";
//Get the physical path to the file.
string FilePath = MapPath("BuildingDataAccessComponent.doc");
//Write the file directly to the HTTP content output stream.
Response.WriteFile(FilePath);
Response.End();
}

With regards,
J.Prabu.
[Email:prbspark@gmail.com]



Responses

Posted by: Wadhwanisanju on: 4/25/2013 [Member] Starter | Points: 25

Up
0
Down
Hi,

Refer this

http://www.codeproject.com/Questions/333114/Display-word-document-in-web-page-asp-net

Hope this helps to you

Thanks and Happy Coding !!

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response