Last post May 22, 2018 07:09 AM by Brando ZWZ
May 21, 2018 08:22 AM|JayRayJay|LINK
After uploading the document, it should show a URL link below the upload control, so user can click and open to see the document. how do i do it?
May 21, 2018 08:57 AM|PatriceSc|LINK
This is just an a link (or a https://msdn.microsoft.com/en-us/library/seey0yt3.aspx control) to the document source. It could point to the actual document or to a location that will serve
the document from its real source (if stored outside of the site or in a db). See perhaps https://www.c-sharpcorner.com/UploadFile/b926a6/image-store-and-retrieve-from-database-using-generic-handler/
and http://www.dailycoding.com/posts/how_to_force_a_file_to_download_in_aspnet.aspx (shown as part of a page but works as well from an ashx handler which you may
want to prefer as it is another concern and avoid to go though the whole ASPX page lifecycle to just write directly to the browser output).
If you need further help please be explicit about the very first problem you are running into when trying to do that...
May 22, 2018 12:12 AM|oned_gk|LINK
Upload the document, save it to database, show the data as grid or repeater with hyperlink
May 22, 2018 07:09 AM|Brando ZWZ|LINK
According to your description, I suggest you could try to use session to achieve your requirement.
We could add the upload file's file name in the list and set the list to session.
Then we could add HyperLink control with the file name path to the page.
More details, you could refer to below codes:
<form id="form1" runat="server">
<asp:FileUpload ID="FileUploadControl" runat="server" />
<asp:Button runat="server" ID="UploadButton" Text="Upload" OnClick="UploadButton_Click" />
<asp:Label runat="server" ID="StatusLabel" Text="Upload status: " />
<asp:Panel ID="Panel1" runat="server"></asp:Panel>
protected void Page_Load(object sender, EventArgs e)
if (Session["filelist"] != null)
Session["filelist"] = new List<string>();
private void ShowHyperLink()
Panel1.Controls.Clear(); //to remove all controls
foreach (var item in (List<string>)Session["filelist"])
HyperLink h1 = new HyperLink();
h1.Text = item;
h1.NavigateUrl = @"http://localhost:52188/uploadfile/" + item;
protected void UploadButton_Click(object sender, EventArgs e)
string filename = Path.GetFileName(FileUploadControl.FileName);
List<string> filepaht = (List<string>)Session["filelist"];
FileUploadControl.SaveAs(Server.MapPath("~/uploadfile/") + filename);
StatusLabel.Text = "Upload status: File uploaded!";
Session["filelist"] = filepaht;
catch (Exception ex)
StatusLabel.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message;