setu
setu

Reputation: 181

Dropzonejs without Form

Is there any way to use Dropzone js without using Form. I want to use like following.But in this way image preview is not showing.

    <div class="dropzone" id="dropzoneForm">
      <div class="fallback">
       <input name="file" type="file" multiple/>
      </div>
    </div>

Upvotes: 8

Views: 18853

Answers (1)

amanuel2
amanuel2

Reputation: 4646

Read more through in the docs and it will explain many problems people faces these days.. Anyways Here is the solution to your problem:

<!DOCTYPE html>
<html lang="en">

  <head>
    <link rel="stylesheet" href="css/basic.css" />
    <link rel="stylesheet" href="css/dropzone.css" />
    <script src="dropzone.min.js"></script>
    <script>
      var myDropzone = new Dropzone("div#myId", {
        url: "/file/post"
      });
      $("div#myId").dropzone({
        url: "/file/post"
      });

    </script>
  </head>

  <body>
    <div id="myId" class="fallback dropzone">
      <input name="file" type="file" multiple />
    </div>
  </body>

What im doing here is giving the div a url to link to so you dont have to use a form!

Upvotes: 12

Related Questions