Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
150
manually upload file via from submit
posted

I am using the mvc helper method to create the file upload control. What I need it to do is submit the file when I submit the form. I have turned off automatic upload but when I click the submit button on the form. No files are posted to the controller. Is there any documentation that you can point me to or any examples?

 

 

Thanks in adavnace,

Gary Cryer

  • 49378
    posted

    Hello Gary,

    In this scenario I would suggest using the button to invoke just the upload for igUpload, and handling the fileUploaded event in order to initiate the form submit:

        <form id="form1" runat="server">
     
            <script type="text/javascript" >
                $(window).load(function () {
                    $("#igUpload1").igUpload({
                        autostartupload: false,
                        progressUrl: "/IGUploadStatusHandler.ashx",
                        fileUploaded: function () {
                            document.forms[0].submit();
                        }
                      
                    });
                });
    </script>
     
     
        <div id="igUpload1">
        
        </div>
     
            <input type="button" value="submit and upload" onclick="$('#igUpload1').igUpload('startUpload',0)" />
        </form>
     

    Please feel free to contact me if you have any questions.