How to upload Iform File in iframe was binding null javascript jquery

0 votes

In asp.net core , i define ProductUpdateRequest has  public IFormFile ThumbnailImage { get; set; } . I create update form in iframe. when I submit form with

jQuery(function ($) {
    $("#btnsubmit").click(function (e) {
        
        //Serialize the form datas.   
        var valdata = $("#updateProductForm").serialize();
        
        //to get alert popup   
        $.ajax({
            url: "/Products/Update",
            data: valdata,
            dataType: "json",
            type: "POST",
            success: function (response) {
                alert(1);
            }
        });
    });   
    
});

asp.net have bind data from the form to request model :

[HttpPost]
        public async Task<IActionResult> Update([FromForm] ProductUpdateRequest request)

but request.ThumbnailImage is null. How can I post img (Iform File) to the server by ajax from iframe? When update action is done, what would I do if I want to get a response to

success: function (response) {
                alert(1);
            }

and told to parent page to reload to update new data? Help me, I can't understand this problem...

Aug 19, 2022 in Web Development by gaurav
• 23,260 points
1,583 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Web Development

0 votes
0 answers

How to filter JSON Data in JavaScript or jQuery?

How to filter JSON data using Javascript ...READ MORE

Jul 1, 2022 in Web Development by rajatha
• 7,680 points
2,474 views
0 votes
0 answers

How to upload a file to api server in node js?

How to upload a file to api ...READ MORE

Oct 14 in Web Development by anonymous
• 2,400 points
64 views
0 votes
0 answers

How to upload a file to api server in node js?

How to upload a file to api ...READ MORE

Oct 21 in Web Development by Nidhi
• 2,400 points
82 views
0 votes
1 answer

How to download a file by jQuery.Ajax?

Hello @kartik, You don't need to do this ...READ MORE

answered Sep 18, 2020 in Web Development by Niroj
• 82,840 points
7,505 views
0 votes
1 answer

how to use substr() function in jquery?

To get substring of a string in ...READ MORE

answered Jun 27, 2022 in Web Development by rajatha
• 7,680 points
1,257 views
0 votes
1 answer

How to loop through array in jQuery?

Generic loop: var i; for (i = 0; i ...READ MORE

answered Jun 28, 2022 in Web Development by rajatha
• 7,680 points
2,224 views
0 votes
1 answer

Ajax using JQuery in ASP .NET c#

jQuery Ajax in ASP.Net $.ajax({      & ...READ MORE

answered Jun 15, 2022 in JQuery by rajatha
• 7,680 points
4,032 views
0 votes
0 answers

UL subdrop not working with jquery in Asp.Net C#

Keep searching why sub drop not working ...READ MORE

Jul 29, 2022 in Web Development by gaurav
• 23,260 points
384 views
0 votes
1 answer

Authenticate on an ASP.Net Forms Authorization website from a console app

Essentially, we need to record a regular ...READ MORE

answered Sep 20, 2018 in IoT (Internet of Things) by Annie97
• 2,160 points
906 views
0 votes
1 answer

Embedding Power Bi Report Promise is not defined powerbi.js

IE does not yet support Promise. You ...READ MORE

answered Oct 30, 2018 in Power BI by Shubham
• 13,490 points
2,055 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP