hi,
can anyone give me the code for displaying the files(txt, pdf, word etc.) on to the browser, if the user selects any file.
How to display uploaded files on browser?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

kiran kumarRank #3,110 · 461 reputationPosted Feb 23, 2010, 5:47 PM EST
http://support.microsoft.com/kb/306654
check it out
MARK THE ANSWER IF IT HELPS YOU
Sam HobbsRank #107 · 20.5K reputationPosted Feb 23, 2010, 6:04 PM EST
Raaj KumarRank #7,836 · 233 reputationPosted Feb 23, 2010, 6:10 PM EST
Try this snippet,
protected void GetFileNames()
{
DirectoryInfo di = new DirectoryInfo(Server.MapPath("TempFiles"));
FileInfo[] files = di.GetFiles();
string saveLocation = Server.MapPath("TempFiles" + "\\");
foreach (FileInfo item in files)
{
Response.Write("
" + item.Name + "");
}
}
Here TempFiles is the folder inside the server which stores any kind of file. A HREF will link to the file and when you click on the link it will open inside the browser provided the browser should support the file format.
Regards,
raaj