This is a migrated thread and some comments may be shown as answers.

Restore clientside file list

2 Answers 84 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Jason Rosensweig
Top achievements
Rank 1
Jason Rosensweig asked on 16 Nov 2010, 09:16 PM
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);
            }
        }
    }
}

2 Answers, 1 is accepted

Sort by
0
Genady Sergeev
Telerik team
answered on 22 Nov 2010, 10:05 AM
Hello Jason Rosensweig,

Yes, there is a way to do that. I am attaching a sample project that demonstrates how to preserve files across postbacks. The project uses the latest DLL, if you version is an earlier one, please specify it and I we will prepare another sample.

Greetings,
Genady Sergeev
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Maxi
Top achievements
Rank 1
answered on 06 Mar 2012, 08:00 PM
Hello, i have the 2011 q3 version, and i want to know if you have an example for the version im using, because the actual example is not working, its throws an error in line var row = upload._appendStyledRow();

thank you. 
Tags
AsyncUpload
Asked by
Jason Rosensweig
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
Maxi
Top achievements
Rank 1
Share this question
or