Click here to Skip to main content
15,890,399 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi

i have already asked this question but i am not getting any information.i am not able to retain the name of the file on post back event.i used session to store the name of the filename and i am able to do it but i am not able to set the session value to the fileupload control. please help me on this with some code.
Posted
Comments
Nilesh Patil Kolhapur 23-May-12 8:58am    
why u want to set value to file upload control

No, it is not possible to set an initial value for a <input type="file" /> element. The reason for this constraint (which is enforced by the browser, not by ASP.NET) is security. Consider the consequences of a malicious website owner placing the following in a form:
HTML
<input type="file" value="c:\bank\secret.key" />

However, I am not sure that this limitation is really a problem in the scenario you are describing. Having the <input type="file"> prefilled with the path to the image file on the server, is unlikely to help anyway, as the value selected in a file field is used to point to a file on the client, which will be uploaded as part of the form postback.

Best Luck
 
Share this answer
 
v2
Not sure on how you used session and yet you failed.

Look here:
How to Maintain FileUpload Control’s State after PostBack[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900