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

Total Post:3

Points:21
Posted by  Nattapong Unaregul
 5910  View(s)
Ratings:
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>
  1. Arun Singh

    Post:68

    Points:476
    Re: 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.

    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.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!