Dropzone images are not coming to the server

Asked

Viewed 89 times

0

I have a normal form and inserted the drozpone inside it following some tips by the community. When I give the Ubmit, the Dropzone images do not arrive at the server in any way, the $_FILES is empty.

HTML FORM

   <form class="multi-page-form" method="post" id="form_publish" enctype="multipart/form-data">
   <div class="row">
      <!-- Dropzone -->
      <div class="dropzone dropzone-previews" id="my-awesome-dropzone"></div>
      <div class="col-lg-6 col-md-6">
         <div class="form-block">
            <label>Título do anúncio</label>
            <input class="border" type="text" name="title">
         </div>
      </div>
      <div class="col-lg-6 col-md-6">
         <div class="form-block">
            <label>Palavras-chave</label>
            <input type="text" placeholder="Insira suas palavras chaves" class="border" data-role="tagsinput" name="keywords" id="tagPlaces">
         </div>
      </div>
      <div class="center">
         <button type="button" id="btn-send-property" class="button button-icon large alt"><i class="fa fa-angle-right"></i> Enviar Imóvel</button>
      </div>
   </div>
</form>

Javascript

    Dropzone.autoDiscover = false;
var myDropzone = new Dropzone('#my-awesome-dropzone', {
    url: 'User/publish',
    paramName: "files",
    autoDiscover: false,
    addRemoveLinks: true,
    maxFilesize: 3.0,
    maxFiles: 30,
    parallelUploads: 10000,
    uploadMultiple: true,
    autoProcessQueue: false
});

$("#btn-send-property").click(function () {
    myDropzone.processQueue();
    $("#form_publish").submit();
});

PHP

echo '<pre>';
    var_dump($_FILES);
    echo '</pre>';
    die();
  • What exactly does var_dump return? php is in the URL User/publish?

  • Returns the input file value 'featured_image' that has nothing to do with Dropzone, what I really want is not returning, yes php is in that url

  • Exactly how to return? Copy and paste the return here.

  • array(1) { ["featured_image"]=> array(5) { ["name"]=> string(0) " ["type"]=> string(0) " ["tmp_name"]=> string(0) " [error"]=> int(4) ["size"]=> int(0) }

  • the unico files that returns is from another input, the Dropzone files returns nothing...

  • The browser url is changing at the time of upload?

  • For sure.....

  • So this wrong, in Dropzone the upload is done by Ajax and then should not change the URL, for sure you are using the Dropzone the wrong way.......

  • It’s just that the way I’m doing Dropzone doesn’t fit, but vlw for helping

  • I’m sure it’s you who is thinking in the wrong way about the operation of HTTP data transport, I’m sure that if you know how to divide the tasks of the problem you can upload it beforehand and then do a normal POST for your existing tasks, as soon as possible I will formulate an answer, just ask you to put the code as this currently to understand your need.

Show 5 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.