Upload/Submit HttpPostedFileBase has zero files

2 posts, 0 answers
  1. Richard
    Richard avatar
    1 posts
    Member since:
    Mar 2014

    Posted 22 Apr 2014 Link to this post

    I am using the "Basic usage" of the Upload control in ASP.NET MVC and Internet Explorer version 9.0.8112.16421

    After I select the file to upload and click "Submit", my Submit() action is indeed called, but "IEnumerable<HttpPostedFileBase> files" contains zero files in the called method:

    public ActionResult Submit(IEnumerable<HttpPostedFileBase> files)
    {
    :
    :
    }

    How can I get the actual files to be uploaded?

    Thanks.
  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2156 posts

    Posted 23 Apr 2014 Link to this post

    Hi Richard,

    Could you please assure whether the files parameter is empty or it is null? If it's the second case, then the most probable reason is that the name attribute of the input type="file" element is different. It should also be called files, as this is way that the model binder works.

    If that is not the case, could you please send me a small example project, which demonstrates the issue, so I could inspect it locally?

    Regards,
    Dimiter Madjarov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top