Valum file upload - Works in Chrome but not IE, Image img = Image.FromStream(Request.InputStream)

后端 未结 1 1669
春和景丽
春和景丽 2021-01-16 09:52

I\'m using a slightly modified version of Valum\'s upload [github link], I\'ve modified it to upload to a database but haven\'t modified the javascript that it is using to g

相关标签:
1条回答
  • 2021-01-16 10:34

    Turns out that there is not an input stream in the Request when using IE as your browser. Ended up fixing the code by pulling it out of the Files array like this:

    if (String.IsNullOrEmpty(Request["qqfile"]))
    { 
        //This works with IE
        HttpPostedFileBase httpPostedFileBase = Request.Files[0] as HttpPostedFileBase;
        byte[] newImageByteArray = GetByteArrayForResizedImage(350, httpPostedFileBase.InputStream);
        byte[] thumbnailByteArray = GetByteArrayForResizedImage(150, httpPostedFileBase.InputStream);
    
        //Do stuff here
    
        return Json(new { success = true }, "text/html");
    }
    else
    {
        byte[] newImageByteArray = GetByteArrayForResizedImage(350, Request.InputStream);
        byte[] thumbnailByteArray = GetByteArrayForResizedImage(150, Request.InputStream);
    
        //Do stuff here
    
        return Json(new { success = true }, "application/json");
    }
    
    0 讨论(0)
提交回复
热议问题