I have an asyncupload control on a form. When the user submits the form, I validate the other form fields server-side and return a message to the user if one or more fields fails that validation. If all of the fields pass, the postback uploads the file as intended. However, if I fail the validation, the asyncupload control file list is cleared. Is there a way to retain the clientside list so the user doesn't have to re-upload the file if I fail the validation? Here is the code that I used for the upload:
protected void upAttachment_FileUploaded(object sender, FileUploadedEventArgs e){ if (MessageSent) { byte[] buffer = new byte[e.File.ContentLength]; using (Stream stream = e.File.InputStream) { stream.Read(buffer, 0, e.File.ContentLength); using (BinaryWriter bWriter = new BinaryWriter(File.Open(UploadDir + "\\" + e.File.FileName, FileMode.Create))) { bWriter.Write(buffer); } } }}