i am trying to save a file from chrome using AjaxSubmit. i got the problem that Chrome send the file in octet format and i am unable to check that if it is really image or anything else.
when i try to call
HttpPostedFileBase file
file.InputStream
inputstream caused error in chrome that Parameter is not valid.
how i开发者_C百科 can save them in asp.net c#
I use this in my view: <input type="file" id="deploymentPackage" name="deploymentPackage" />
And in my controller, I do this:
public ActionResult AddRelease(ApplicationReleaseViewModel appRelease, HttpPostedFileBase deploymentPackage)
        {
            if (ModelState.IsValid)
            {
                ApplicationRelease dto = new ApplicationRelease();
                appRelease.UpdateDto(dto);
                using (StreamReader sr = new StreamReader(deploymentPackage.InputStream))
                {
                    dto.DeploymentPackage = new byte[deploymentPackage.InputStream.Length];
                    deploymentPackage.InputStream.Read(dto.DeploymentPackage, 0, dto.DeploymentPackage.Length);
                }
                this.ApplicationService.AddApplicationRelease(dto);
                return RedirectToAction("Index", new { ActionPerformed = "ApplicationReleaseAdded", Name = appRelease.Name.CutToMaxLength(50).UrlEncode() });
            }
            else
            {
                ViewBag.PostAction = "AddRelease";
                return View("EditRelease", appRelease);
            }
        }
UPDATE: Look at this link, if you can't abstract yourself from "my" code.
http://www.codeproject.com/KB/aspnet/Implementing_HTTP_File_Up.aspx
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论