This project is read-only.

Dropzone and Anti-forgery

Topics: Customizing Orchard, Writing modules
Jan 30, 2015 at 7:04 PM
Edited Jan 30, 2015 at 7:05 PM
I think I would like to use Dropzone to upload some files to my orchard webserver. I would like to post back to my producer mvc controller. I have not been able to get the postback to work without disabling anti-forgery like this <!-- <%= Html.AntiForgeryToken() %> -->

I really need to learn more about this whole process, but right now I would love some help on getting my example below to work WITH Anti-Forgery working. I am not sure how to get the form setup so that it works correct with dropzone AND orchard antiforgery token. If you are able to point me in the right direction or an online example it will be greatly appreciated.


<!-- <%= Html.AntiForgeryToken() %> -->
<div id="layout-dashboard">
        <div class="jumbotron">
            <form action="~/Producer/SaveLogo" class="dropzone" id="dropzoneJsForm"></form>
            <button id="submit-all">Submit All Files</button>


    Dropzone.options.dropzoneJsForm = {

        //prevents Dropzone from uploading dropped files immediately
        autoProcessQueue: false,

        init: function () {
            var submitButton = document.querySelector("#submit-all");
            var myDropzone = this; //closure

            submitButton.addEventListener("click", function () {

                //tell Dropzone to process all queued files