我使用Valums Ajax上传器。所有在Mozilla与此代码的伟大工程:MVC Valums Ajax Uploader - IE不发送请求流.InputStream
查看:
var button = $('#fileUpload')[0];
var uploader = new qq.FileUploader({
element: button,
allowedExtensions: ['jpg', 'jpeg', 'png', 'gif'],
sizeLimit: 2147483647, // max size
action: '/Admin/Home/Upload',
multiple: false
});
控制器:
public ActionResult Upload(string qqfile)
{
var stream = Request.InputStream;
var buffer = new byte[stream.Length];
stream.Read(buffer, 0, buffer.Length);
var path = Server.MapPath("~/App_Data");
var file = Path.Combine(path, qqfile);
File.WriteAllBytes(file, buffer);
// TODO: Return whatever the upload control expects as response
}
这是在这个岗位回答:
但问题是,这在IE中不起作用。我发现这一点,但我无法弄清楚如何实现它:
IE不 “request.InputStream”通过 HttpPostedFileBase从发送流...而不是让 输入流在 Request.Files []集合
此外,这在这里显示这个家伙是怎么做到的,但我不知道如何为我的项目更改:
Valum file upload - Works in Chrome but not IE, Image img = Image.FromStream(Request.InputStream)
//This works with IE HttpPostedFileBase httpPostedFileBase = Request.Files[0]
as HttpPostedFileBase;
不能找出这一个。请帮忙! 谢谢
呀!你刚刚救了我一百万小时 - 谢谢。 – 2012-02-01 13:36:37