mcintyre321 / FormFactory

MVC5, Core or standalone - Generate rich HTML5 forms from your ViewModels, or build them programatically

Home Page:http://formfactoryaspmvc.azurewebsites.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to add FileUpload Object in Programatically created form?

fatihcelen opened this issue · comments

Hi i look code but don't see any file upload attribute for input. how can i add file upload object in form.

You can add either

  • add an XElement with the correct tag and attributes to your viewmodel
  • add your own cshtml template for a custom FileInput object that you would define

When I add Property.BlaBla.FileUpload.cshtml in View Folder i get this error.

Severity Code Description Project File Line Suppression State
Error NETSDK1022 Duplicate 'EmbeddedResource' items were included. The .NET SDK includes 'EmbeddedResource' items from your project directory by default. You can either remove these items from your project file, or set the 'EnableDefaultEmbeddedResourceItems' property to 'false' if you want to explicitly include them in your project file. For more information, see https://aka.ms/sdkimplicititems. The duplicate items were: 'Views\Shared\FormFactory\Property.BlaBla.FileUpload.cshtml' FormFactory (FormFactory\FormFactory) C:\Program Files\dotnet\sdk\2.1.509\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets 257

Is There any example for file input created with XElement programmatically.

formModel.Add(new PropertyVm(typeof(XElement), "cFoto") { DisplayName = "Document Upload", Value = XElement.Parse("<input type='file' class='form-control' multiple='multiple' value='Upload'></input>") });