Вы можете опубликовать HttpPostedFileBase
на своей бритве.
if (upload != null)
{
using (var inputStream = upload.InputStream)
{
var memoryStream = inputStream as MemoryStream;
if (memoryStream == null)
{
memoryStream = new MemoryStream();
inputStream.CopyTo(memoryStream);
}
var data = memoryStream.ToArray();
}
Подпись метода должна быть такой
[HttpPost]
public ActionResult Foo(HttpPostedFileBase upload)
{
}
И ваша сторона бритвы:
@using (Html.BeginForm("Foo", "ControllerName", FormMethod.Post, new { @enctype = "multipart/form-data" }))
{
}