0
I’m not getting past the variables in the ajax method.
<input type="file" id="id-input-file-2" name="arquivo" class="form-control arquivo" />
<input type="hidden" name="ID_Cotacao" id="ID_Cotacao" value="555">
.
$(function(){
$('.arquivo').change(function(e){
if ($('.arquivo').val() != "") {
e.preventDefault();
var formData = new FormData();
formData.append('arquivo', $('.arquivo').prop('files')[0]);
formData.append('nomeArquivo', $('.arquivo').val());
formData.append('id_cotacao', $('#ID_Cotacao').val());
$.ajax({
url: 'cotacoesEditarUpload.php',
data: formData,
type: 'GET',
success: function(){
alert("Enviado com sucesso."),
$(".listaArquivo").load(window.location + " .listaArquivo")
},
processData: false,
cache: false,
contentType: false
});
};
});
});
How it appears in the browser console: quotesEditarUpload.php? [Object Formdata]&_=1441423098339
What am I doing wrong?
@Brunno did not work. Same problem.
– Tiago
we’ll have to wait for someone to mess with php to help you :PP just gave a sour guess hahaha' :DD
– Brunno
Thank you very much for the tip. If you have another I will be happy to test :)
– Tiago
Some light at the end of the tunnel?
– Tiago
@Brunno so worked the variables
data: 'arquivo'+ $('.arquivo').prop('files')[0] +'&nomeArquivo='+ $('.arquivo').val() +'&id_cotacao='+ $('#ID_Cotacao').val(),
but the file is not sent, only the variables. Knows how to do?– Tiago