Show file name on the view


This Content is from Stack Overflow. Question asked by Learner

im new on stack overflow and i dont how to post my question properly. how do i wanna show the file name in view? currently i just hardcode the name of the file on view.

can someone assits me? thank you very much

Here my code :-

@if (Model.Picture2 != null)

base2 = Convert.ToBase64String(Model.Picture2);
var picture2_data = base2.Substring(0, 5);

if (picture2_data == "JVBER")//PDF
  var downloadTag = "PDPA" + Model.SenderID;
  imgSrc2 = String.Format("data:application/pdf;base64,{0}", base2);

<a download=@downloadTag class="fa fa-file-pdf-o" style="font-size:18px;color:red" href=@imgSrc2></a>
<a download=@downloadTag href=@imgSrc2 title='PDPA'>PDPA</a>
<br />



base2 = Convert.ToBase64String(Model.Picture2); imgSrc2 = String.Format("data:image/gif;base64,{0}", base2);
<a class="fancybox-buttons" rel="fancybox-button" data-lightbox="button" href="@imgSrc2" title="PDPA"><img src="@imgSrc2" style="max-width:100px; max-height:100px;" alt="" /></a>



This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?