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 124 posts 231 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)
            {
                //
            }
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies