I have been working on this whole day. I do not want to use any fancy plugin. My problem is basically this: In asp.net c#, the user can create an instance of an class (let's say student) and each instance has a file (image). I am using AJAX, and the code works fine. When user presses create button, I want to also send the posted file to the Page method, which can can save the file, while adding the record to the db. However, I am not able to get the posted file as FileInfo in Page method but as string. Is there a way to make this work?
function addBadge() {
            var badgeName = $('#txtBadgeName').val();
            var badgeDesc = $('#txtBadgeDesc').val();
            var badgeImage = $('#file_BadgeImage').get().files[0];
            $.ajax({
                type: "POST",
                url: "/Instructor/ManageBadges.aspx/CreateBadge",
                data: "{badgeName:'" + badgeName + "', \
                        badgeImage:'" + badgeImage + "',\
                        badgeDescription:'" + badgeDesc + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    .....
                    }
                }
            });
        }
[WebMethod]
    public static string CreateBadge(string badgeImage, string badgeName, string badgeDescription)
    {
        //HERE HOW CAN USE badgeImage ??
        //HOW CAN I CONVERT IT TO FileInfo and save ?
        Guid badgeId = Guid.NewGuid();
        BadgeInfo newbadge = new BadgeInfo();
        newbadge.BadgeId = badgeId;
        newbadge.BadgeName = badgeName;
        newbadge.BadgeDescription = badgeDescription;
    }
 
     
    