Dropzone.js how to serialize values and send it?

drag-and-drop, javascript, jquery

Solution

If `enqueueForUpload` is set to `true` (default), the files get uploaded directly as in a normal file-upload form.

In your case, you need to have your upload-script in `post.php`. There, the file will come in as `$_FILES['photos']` (`paramName`). This paremeter name is 'file' by default, but you set it different.

Is this clear?

So a simple example as for the content of your `post.php`-file:

if(!empty($_FILES)){
   move_uploaded_file($_FILES['photos']['tmp_name'],'http://mysite.com/myDir');
}

Problem

Im im totally stuck with Dropzone.js, i would like to create a drag and drop file upload Setting it up is okay ``` <form id='test' enctype="multipart/form-data"> <input type="text" name="album_name"> <div id="myId" class="dropzone"> </div> <button type="submit" id="newAlbum">go go</button> </form> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script src="http://malsup.github.com/jquery.form.js" type="text/javascript" charset="utf-8"></script> <script src="https://raw.github.com/enyo/dropzone/master/downloads/dropzone.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript"> $(document).ready(function(){ $("#myId").dropzone({ paramName: 'photos', url: "post.php", dictDefaultMessage: "Drag your images", clickable: true, enqueueForUpload: true, selectedfiles: function() { $('#newAlbum').show(); } }); }); </script> ``` But i have no clue hot to serialize the form, and send it Could please someone show me an example?

Original source