Home > DeveloperSection > Forums > I want to get full path of <asp:fileupload > and then client can click the Preview button to see what file he/here has uploaded.
Nattapong Unaregul
Nattapong Unaregul

Total Post:3

Points:21
Posted on    July-22-2012 8:29 PM

 ASP.Net ASP.Net 
Ratings:


 1 Reply(s)
 5016  View(s)
Rate this:
Here is my current code,When user browse his/her file the Preview button will be enabled 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
        <asp:FileUpload ID="FileUpload1" runat="server" onchange="FileUpload_OnChange(this,event);"   />  &nbsp; &nbsp; &nbsp;
<input  type="button" id ="Preview" value = "Preview" disabled="true"/>
 function FileUpload_OnChange(sender, e) {
        document.getElementById("Preview").disabled = false;
        }
</asp:Content>


Arun Singh

Total Post:68

Points:476
Posted on    July-23-2012 1:55 AM

Hi Nattapong Unaregul,
Actually I didn't get you properly that what are you trying to ask ?If you want the total client side drive path like "c:\User\Desktop" to be upladed via fileupload control, then try this code:
System.IO.Path.GetFullPath(FileUpload1.PostedFile.FileName) and For previewing file you can read file content via using Stream theStream = FileUpload1.PostedFile.InputStream; and after that you could preview the file to the client.

Don't want to miss updates? Please click the below button!

Follow MindStick