You must Sign In to post a response.
  • Category: ASP.NET

    File upload problem

    I have a FileUpload control in aspx page and when user select a file, the full file path will will be stored in a hiddenfield, and during postback, i would like to assign the full file path in the hiddenfield back to the FileUpload control textbox, possible to achieve that?
  • #572761
    You can assing the value to the Hidden Filed like this...

    and call this as the Filename changes in the text or label.

    function setHiddenValue()
    document.getElementById("Hidden1").value = document.getElementById("File1").value;

    On the page load check the value of this hidden field, if there is any set it to the label or text box.

    Thanks & Regards
    Anil Kumar Pandey
    Microsoft MVP, DNS MVM

  • #572764
    It was possible in Older Versions of Browsers like IE 6.0 or less. But, latest version of Browsers restricts the user to read the local path of a system from server side for some security reasons. It is wise the store the file in the server first and then, read the server path.

    Thanks & Regards
    Paritosh Mohapatra
    Microsoft MVP (ASP.Net/IIS)
    DotNetSpider MVM

  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.