I have a FileUpload control in my ASP page. Once I choose a file from disk it will display the full path C:\users\star\one.jpg on its textbox.
<asp:FileUpload ID="filUpload1" runat="server" />
Then I have done some validation clicking button. As result of that button click event it will occur page refresh. And it will clear that file path on control.
How Can I display FileUpload full path after page refresh?
I have tried ViewState ,However it dosn’t allow me to store full path itself. Please help me.
This is not possible.
Asp.net uses html forms to send its data. Due to browser security constraints and user privacy issues, the full path is not sent to the server.
However on the next postback that occurs, the full file does get uploaded to the server.
Using the FileUpload control, the contents of the file are only available on the first postback after the user selected the file.
What you should do is save this file at that time, and make a note of it in the ViewState(Where you saved the file on the server).
When when final submit occurs, you can use the file that is already uploaded on your server.