Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Le Xuan Trung 10 posts 80 karma points
    Aug 07, 2015 @ 08:07
    Le Xuan Trung
    0

    Request.Files does not exist when I inherit an UmbracoApiController

    in my code, i have used ajax to pass file from view to controller. But i can't use" request.file", help me, please. Thanks View $('.submit').click(function() {

                $.ajax({
                    type: "POST",
                    url: "/umbraco/api/SignUp/UploadAnh",
                    data: formData,
                    datatype: "Json",
                    success: function() {                            
                    }
                });
            });
    

    controller

    [HttpPost]
            public ActionResult UploadAnh()
            {
                try
                {
                    foreach (var ifile  in Request.Files)
                    {
                        //
                    }
    
                }
                catch (Exception)
                {
    
                    return null;
                }
                return new RedirectToUmbracoPageResult(1325);
            }
    
  • Arjan Woldring 118 posts 224 karma points
    Aug 07, 2015 @ 11:44
    Arjan Woldring
    0

    I'm not totally sure but you might want to try this:

            foreach (var ifile in HttpContext.Current.Request.Files)
            {
                //
            }
    
Please Sign in or register to post replies

Write your reply to:

Draft