I am having form like this:
<form action="/Art/Add" type="POST">
<input type="text" name="ddd" value="testttt" />
<input type="file" name="files" />
<button>Add</button>
</form>
Then i submit file to it and submit form and header looks something like this (it has more data than shown here)
And here is the server side code:
[Route("/Art/Add")]
public IActionResult Add(TempArtClass artModel)
{
JsonResult t = base.ImageUpload(artModel.files).Result as JsonResult;
string[] fullFilePathsReturned = t.Value as string[];
User<UserCustomProperties> cu = Request.GetUser();
if (cu == null)
return View("Error", "You do not have permission to add new art!");
if (string.IsNullOrWhiteSpace(artModel.art.Name))
return View("Error", "You must enter name!");
if (artModel.art.Name.Length > 32)
return View("Error", "Name must not exceed 32px!");
Art<ArtInformation>.Add(artModel.art.Name, cu.ID, artModel.art.Price, artModel.art.Details, artModel.art.VAT, fullFilePathsReturned[0], artModel.art.Type, artModel.art.Tag);
return Redirect("/" + cu.Name + "/a/" + artModel.art.Name);
}
TempArtClass is this:
public class TempArtClass
{
public Art<ArtInformation> art { get; set; }
public List<IFormFile> files { get; set; }
public string ddd { get; set; }
}
and when i debug ddd
has value, art
class has value but my files
is null.... I also tried adding multiple
to html tag <input>
but it is not working.