Upload image and video in 2 IFormFile Asp.net Core

Viewed 63

I have a form that i need upload images and videos, for images work perfectly, but if i try upload videos all my model return null. If i upload only images work fine. I notice if i remove accept="video/*" from imput for video work, but i need this input for videos

public class AnuncioDTO
{
    public List<IFormFile> FotoUpload { get; set; }
    public List<IFormFile> VideoUpload { get; set; }

}

controller:

     [HttpPost]
    public async Task<IActionResult> SalvarAnuncio(AnuncioDTO model, List<IFormFile> FotoUpload, List<IFormFile> VideoUpload)
    {
    }

my razor

<form asp-action="SalvarAnuncio" asp-controller="Anuncio" method="post" name="criar-anuncio" enctype="multipart/form-data" id="msform">
    
      <input  type="file" asp-for="FotoUpload" name="FotoUpload"  multiple="multiple" class="form-control"  accept="image/*">

      <input type="file" asp-for="VideoUpload" name="VideoUpload" multiple="multiple" class="form-control"  accept="video/*">
 </form>

result if i try upload video, my entire model get null enter image description here

if upload only images work fine, but videos is null even i add multiple videos enter image description here

1 Answers

Solved. The problem was the size of videos, max size suported is 10mb

Related