0
Is there any way I won’t lose data from HttpPostedFileBase
? my action makes a check, and in case of failure the page recharges with the image in the form and I have to make the call again, then HttpPostedFileBase
will null unless I choose the image again.
@{
Dictionary<string, object> htmlAttributes = new Dictionary<string, object>();
htmlAttributes.Add("id", "delivery-form");
htmlAttributes.Add("class", "middle-forms");
htmlAttributes.Add("enctype", "multipart/form-data");
}
@using (Html.BeginForm(actionName, "DeliveryService", ViewBag.Routes as RouteValueDictionary, FormMethod.Post, htmlAttributes @*new { @id = "delivery-form", @class = "middle-forms" }*@))
{
UPDATE
One solution I came up with was to use a Session
to save data from HttpPostedFileBase
, being like this:
Session["ImportFile"] = ImportFile;
I believe that it does not exist, because if it were possible to assign a value to a
input
of the kindfile
from the server we would have a serious browser security failure.– Oralista de Sistemas
Maybe you can do a partial validation before posting the image?
– Oralista de Sistemas
You could do the validation in the client...
– Aline
We had already talked before here in the project about this validation, the best way will be to change even.
– Vinicius
suddenly save the item to localstorage and resend to Submit
– Rafael Larrosa
I’m trying the @Rafaellarrosa tip from localStorage, I’m trying to send it to Submit now.
– Vinicius