Click here to Skip to main content
14,878,186 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am making file upload control, I have a file upload control i have set its style display none and i have a button for uploading files

OnClicking the upload button i am opening fileupload' control Upload dialog, after after selecting file i have to submit the form but the form is not submitting even not any error msg is appearing,below is my code

C#
<input type="file" id="newimg" style="display: none">
<input type="button" id="updnewimg">


  $('#updnewimg').live('click', function () {
            $('#newimg').click();
        });


 $('#newimg').change(function () {
            $("#ImgForm").submit();

        });


where ImgForm is my form's ID i've to use button here instead of submit
Posted

1 solution

you can use ajax for this such as in the following example:
C#
$('#buttonId').click(function () {
$.ajax({
                   type: 'POST',
                   url: '/YourController/ActionName',
                   data: { Email: email, Name: name },
                   success: function (data) {
                       alert(data.message);
                       clear();
                   }
               });
 });


try this:
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900