I am using ASP.net(2.0) with VB.NET.
I have a User registration form. On that form the user supply all his contact details and he can upload a image with the normal file upload control in ASP.net.
This is my problem.
If anything goes wrong on the page then i give the User a error message saying what he left out or what went wrong. But the page refresh when that does happen. NOW the link to the image the user selected is gone. NOW when the user fix his error he thinks that he is uploading a picture but he never did because when the page re loaded it removed the link to his image inside the file upload control.
Note, the user don’t have to upload a image, so there will be no error when the field is blank.
Anyone have an idea what I must do?
That behaviour is by design. It is a security restriction imposed by browsers so that all files are uploaded from users’ computers only by their explicit action.
If something does go wrong during form submission, you should intimate the user to re-upload his/her file. That is the right way to do it. Think of it as a Transaction (all or nothing).