Link to home
Start Free TrialLog in
Avatar of Crystal Rouse
Crystal RouseFlag for United States of America

asked on

Need help troubleshooting DropZone in a partial View

I am using DropZone in a partial View.  I never reach the controller.  Can you help me troubleshoot this please?

My Partial View has:

@using (Html.BeginForm(new
{
    @id = "DocUpload"
}))
{
    <div id="DocumentUpload" class="dropzone">
        <div class="fallback">
            <input name="file" type="file" multiple />
        </div>
    </div>
}


<script type="text/javascript">
    $(function () {
        Dropzone.autoDiscover = true;
        new Dropzone('#DocumentUpload', {
            autoProcessQueue: true,
            maxFilesize: 10000,
            acceptedFiles: 'image/jpeg,image/jpg,image/png,application/pdf,.doc,.docx',
            url: '@Url.Action("Upload", "Document", new { id = Model })',

            init: function () {
                var myDropzone = this;

                this.on("success", function (files, response) {
                    $("#DocUpload").dialog("close");
                });
                this.on("error", function (files, response) {
                    $("#DocUpload").dialog("close");
                });
            }
        });
    });

</script>

Open in new window


The controller method is never called.  I am able to drag or drop in a file and the "view" closes as it should but the controller is never reached to update the database.
ASKER CERTIFIED SOLUTION
Avatar of lenamtl
lenamtl
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial