Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

HttpPostedFileBase is NULL  in controller Not Receiving the File Name!!

$
0
0

Summary of the problem I am having:

 HttpPostedFileBase is NULL  in controller Not Receiving the File Name!!

Error I am receiving:

HttpPostedFileBase is NULL  

My code:

<label class="file-upload" style="height: 0px;" ><img src="~/Image/Excel-Upload.png" /><input type="file" id="myfile" style="width: 24px; height:24px" 
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"></label> 
<script>$('#myfile').on("change", function () {
var formdata = new FormData($('form').get(0));
CallService(formdata);});function CallService(file) {$.ajax({
        url: '@Url.Action("UploadAttendeeFile", "Attendee")',
        type: 'POST',
        data: file,
        cache: false,
        enctype: "multipart/form-data",
        processData: false,
        contentType: false,
        success: function (color) {
            ;
        },
        error: function () {
            alert('Error occured');
        }
    });
}</script>
 [HttpPost]
        public ActionResult UploadAttendeeFile(HttpPostedFileBase file)
        {
            // Why HttpPostedFileBase is giving NULL Value always
            //// ?????

            return View("AttendeesList");
        }





Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>