1
Good evening. I am trying to get the files via formData but an empty form is coming.
Follows the codes:
<form action="<?=base_url()?>clientes/addNewFile" id="form_addNewImage" enctype="multipart/form-data" method="POST">
<div class="row">
<div class="col-md-12">
<span class="btn btn-primary btn-file">
<span class="fileinput-new"><i class="material-icons">add</i> Adicionar Imagens</span>
<input type="file" id="cliente_fotos" name="cliente_fotos[]" multiple>
<input type="hidden" name="idCliente" value="<?=$cliente->idCliente?>">
<input type="hidden" name="cliente_Cpf" value="<?=$cliente->cliente_cpf?>">
<input type="hidden" name="clienteFotos" value="<?=$cliente->cliente_fotos?>">
<input type="hidden" name="type" value="img">
</span>
</div>
<div class="col-md-12 mt-3">
<div class="row" id="image_view"></div>
</div>
<div class="col-md-12 mt-3">
<div class="row" id="image_preview"></div>
</div>
<div class="col-md-12 mt-3">
<button type="submit" class="btn btn-primary" data-loading-text="<i class='fa fa-spinner fa-spin '></i> Salvando"><i class="fa fa-floppy-o"></i> Salvar</button>
</div>
</div>
$('#form_addNewImage').on('submit', function(e)
{
e.preventDefault();
var data = new FormData(this);
});
Where are you checking that it is empty? You will use Ajax?
– Sam
I will use ajax yes. I checked that it is empty via console.log(date);
– José Luis
The console does not show Formdata content, but the form arrives at the normal destination.
– Sam
Ta blz friend. I will test. Thank you
– José Luis