<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:FileUpload ID="FileUpload1" runat="server" onchange="FileUpload_OnChange(this,event);" />
<input type="button" id ="Preview" value = "Preview" disabled="true"/>
function FileUpload_OnChange(sender, e) {
document.getElementById("Preview").disabled = false;
}
</asp:Content>
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.
7235
22-Jul-2012
Here is my current code,When user browse his/her file the Preview button will be enabled
Anonymous User
23-Jul-2012Actually 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.