I'm using the dropzone library, it's working the only problem is that the selected files do not reach the server, it always returns me Undefined index files , which could be ?
The form looks like this:
<h4 class="card-title">Escolha as imagens do seu anúncio</h4>
<form method="POST" id="myFirstDropzone" action="<?= base_url('Anunciante/adicionarImagens'); ?>" class="dropzone" enctype="multipart/form-data">
<div class="fallback">
<input name="files[]" type="file" multiple>
</div>
</form>
JavaScript
Dropzone.options.myFirstDropzone = {
paramName: "files",
maxFilesize: 2, // MB
autoProcessQueue: false,
uploadMultiple: true,
parallelUploads: 3,
maxFiles: 3
});
$("#btn-adicionar-img").click(function(){
$("#myFirstDropzone").submit();
});
Controller
public function adicionarImagens(){
echo '<pre>';
var_dump($_FILES['files']);
echo '</pre>';
die();
$this->anunciante->adicionaImagens($_FILES['files'], $this->session->userdata('id_anuncio'));
}