Trying to get File uploads to work in ASP.NET MVC but Request.Files is always empty?
There a few things you might have done wrong!
The form tag must have enctype=”multipart/form-data” and your file input tag must have a name not just an id like below.
<% using(Html.BeginRouteForm("submission_create_path", FormMethod.Post, new { enctype = "multipart/form-data" })) { %> <input id="sourceCode" name="sourceCode" type="file" /> <input type="submit" value="Upload" /> <% } %>
The “name” tip saves a few hours for me, thanks