This is a migrated thread and some comments may be shown as answers.
Upload control being cleared after POST
1 Answer 29 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ryan
Top achievements
Rank 1
Ryan asked on 07 May 2011, 05:34 AM
Hi Telerik,
    I am using the MVC Upload control and am running into a problem where the upload attachments are cleared after every post. I have it on a form, and when the form is submitted, I POST to the controller, where I run some server side validation. If the server side Validation fails, I set the ValidationMessage to display the error and return View(). However, after the POST, all attachment info is cleared. Is there some way to preserve the attachment info after the POST, or to prevent the Upload control from clearing if the form fails server side validation?

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 09 May 2011, 07:58 AM
Hello Ryan,

I believe this is the normal behavior for the standard <input type="file" /> as well. Values are not preserved across page reloads.

You should consider using the Upload in asynchronous mode. It will allow you to upload the files to a temporary location and keep them there until the user has completed the form. This help article will give you and idea on how to maintain the association between the user and the uploaded files - Sending and receiving metadata.

I hope this helps.

Kind regards,
Tsvetomir Tsonev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Upload
Asked by
Ryan
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Share this question
or