How to install upload button in dropzone.js

I am using dropzone.js as per my requirement.

I want to use a div as a file upload control, for example, when the user drags a file into the div, it should show the uploaded files, and when the user clicks the submit button, he should go to the server, next other stuff.

But here I ran into a problem like: with Form only it works, when I upload a file, it goes directly to the server with the file, I wrote as

 <form action="~/Employer/GetFile" method="post" enctype="multipart/form-data" class="dropzone" id="dropzoneForm" style="width: 50px; background: none; border: none;">
    <div class="fallback">
        <input name="file" type="file" />
        <input type="submit" value="Upload" />
    </div>
 </form>  // Working Fine , 


 <div class="watermark pull-left margin-top-1 dropzone" id="divDropFile"></div> // Not wroking, 

      

it should only download files as dropzone.js without target urls, it should only go to the server when only the file download button is clicked, Also, the file is not working.

Please help me everyone .. if this is not possible without submitting the form, please suggest any suggestion for an alternative solution.

+3


source to share


1 answer


I'm not on my development computer, so I can't try, but there are two things that might help.

1) The div you want to use as the dropzone hotspot should not have a dropzone class. It needs the dz-message class. Write it like this:



<div class="watermark pull-left margin-top-1 dz-message" id="divDropFile" data-dz-message></div>

      

2) If you don't want it to automatically send the file to the server, you need to add autoProcessQueue = false to the Dropzone.options object. Then you need to manually call myDropzone.processQueue () later to download the files.

+1


source







All Articles