Two input(File) in same webpage

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • deegeorge
    New Member
    • Nov 2008
    • 58

    Two input(File) in same webpage

    Hi,
    I have two input(file) controls in a web page. When clicking on first control browse button it is selecting a file and assigning into the textbox. When clicking on second control(browse button) the value in the first control(in textbox) is getting cleared. i need to avoid that one. Is there any way....


    Please help.....

    Regards,
    Deepa
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    This is not normal behaviour if these are the steps that are happening:
    • user clicks browse button (file upload 1)
    • file open dialogue is displayed
    • user selects file and clicks ok
    • file open dialogue is closed and path is placed into text box
    • user clicks browse button (file upload 2)
    • file open dialogue is displayed
    • user selects file and clicks ok
    • file open dialogue is closed and path is placed into text box


    However if these are the steps:
    • user clicks browse button (file upload 1)
    • file open dialogue is displayed
    • user selects file and clicks ok
    • file open dialogue is closed and path is placed into text box
    • user clicks a button, link button, or otherwise causes a postback to the server


    Then it is correct that the text is cleared from the FileUpload control.

    You cannot access the TextBox of the FileUpload control to replace the path. This is for security reasons. For instance, you could be writing code that places a path to sensitive data (like a password file or something) instead of what the user intended.

    Therefore, if your page is posting back to the server, the FileUpload control will be cleared. There is no changing this behaviour.

    So, again I ask, why is your FileUpload control getting cleared?

    -Frinny

    Comment

    Working...