0

I need upload image with model. But editorfor showing a different html control.

enter image description here

Model

<Required(ErrorMessage:="Logo is Required")>
<DataType(DataType.Upload)>
<Display(Name:="Logo", ResourceType:=GetType(RestaurantModelStrings))>
Public Property Logo As HttpPostedFileBase

View

   @Html.EditorFor(Function(m) m.Logo)

1 Answer 1

2

Use TextBoxFor like this:

 @Html.TextBoxFor(Function(m) m.Logo, new { type = "file" })
Sign up to request clarification or add additional context in comments.

5 Comments

Sorry its generated file input but now doest fill my model. it is coming null
what is Function(m) perfrming??
for vb.net lambda . And i think problem from ajax.beginfrom. ajax.beginform does not support file upload. i could not fix this
what is the solition of this problem ?
i mostly use this plugin for file uploading via ajax:powerdotnetcore.com/asp-net-mvc/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.