Asp.net fileupload Excluded after postback without AJAX

I am using asp.net 2.0 without AJAX. The file path in the file upload control will disappear after the postback occurs. I am doing some checking for other controls in the code. I need to upload the file again for further processing. can anyone suggest me how to keep the file path in the file upload control even after postback.

+2


source to share


2 answers


I agree with Silk. The FileInput control cannot store a value in the feedback columns.



A possible workaround for this might be how GMail handles attachment uploads. The file can be placed in some temporary location on the server, and after the message back, display a label indicating that the file is already selected and provide a delete button. The problem is that you should consider cleaning these files.

+2


source


This is not possible for security reasons. You cannot set a field on the client side and it will not stay set after posting. The reason for the security is that if it were allowed for installation, you could download any file from the user's computer at will, which would be bad.



+1


source







All Articles