52得票2回答
如何将HttpPostedFileBase转换为图像?

我正在使用ASP.NET MVC,有一个上传文件的操作,文件已经成功上传。但我想获取图像的宽度和高度。我认为我需要首先将HttpPostedFileBase转换为Image,然后再进行下一步。如何操作? 如果有更好的方法获取图像的宽度和高度,请告诉我。

52得票3回答
MVC 6 HttpPostedFileBase?

我试图在 MVC 6 中上传图片,但是我找不到 HttpPostedFileBase 类。我已经检查了 GitHub,但没有任何结果。有人知道在 MVC6 中上传文件的正确方法吗?

28得票3回答
MVC3中的HttpPostedFileBase第一次上传没有数据,但后续上传有数据

问题的背景。 编辑3 我可以证实,在Chrome 20中似乎又可以工作了。谢谢! TLDR更新 编辑2 在进一步研究后,发现这似乎是Chrome 19中的一个错误。请参见此处: http://groups.google.com/a/chromium.org/group/chromium...

25得票3回答
MVC3如何检查HttpPostedFileBase是否为图像

我有一个像这样的控制器:public ActionResult Upload (int id, HttpPostedFileBase uploadFile) { .... } 我该怎么确保uploadFile是一张图片(jpg、png等)?我已经尝试过:using (var bitmapIma...

24得票4回答
ASP.NET MVC在参数为Model时的posted file模型绑定

是否有办法使 ASP.NET MVC 中的模型绑定可以自动处理提交的文件 (<input type="file" />),而无需手动查看请求上下文中的自定义模型绑定器,并且不需要创建仅接受已提交文件作为输入的单独操作方法? 我原本以为这会起作用:class MyModel { ...

24得票3回答
模拟HttpPostedFileBase和InputStream进行单元测试

我想测试以下代码行:... Bitmap uploadedPicture = Bitmap.FromStream(model.Picture.InputStream) as Bitmap; ... 图片是我模型类型 HttpPostedFileBase 的一个属性。 因此,我想为单元测试模拟一...

16得票1回答
HttpPostedFileBase与HttpPostedFileWrapper的关系

我了解HttpPostedFileBase和HttpPostedFileWrapper之间的关系,即它们在单元测试/模拟方面的需要。但是,为什么当我在HttpPostedFileBase返回上设置断点时,它显示为HttpPostedFileWrapper呢? 此外,HttpPostedFil...

13得票4回答
ASP MVC文件上传,HttpPostedFileBase为空。

我在控制器中有这样一段代码,因为我想要填写一些关于视频的详细信息并上传它,但Video类不需要实际的视频文件,因为它将被传递给另一个web服务。public class VideoUploadModel { public HttpPostedFileBase vid {...

12得票2回答
如何将HttpPostedFileBase转换为字符串数组

public ActionResult Import(HttpPostedFileBase currencyConversionsFile) { string filename = "CurrencyConversion Upload_" + DateTime...

11得票3回答
ASP.NET MVC 4 C# HttpPostedFileBase,如何存储文件?

模型public partial class Assignment { public Assignment() { this.CourseAvailables = new HashSet<CourseAvailable>(); } ...