Uploading by ajax

0

I made the code in ajax to send information through the click method, however the file does not arrive in the email, only other data, in the Console appears the array with file type, size, name, everything right but it is not working ... I do not know how to insert the php excerpt here, but sending the form directly by php works, then the error can only be in the ajax file handling

$("#enviar").click(function() {
  var form_data = new FormData();
  var file_data = $("#image1").prop("files")[0];
  form_data.append("#image1", file_data);
  form_data.append("nome_completo", $("#nome_completo").val());

  var settings = {
    "url": "curriculo.php",
    "method": "POST",
    "processData": false,
    "contentType": false,
    "data": form_data
  }

  $.ajax(settings).done(function(response) {
    console.log(response);
  });
});
<form id="msform" method="post" action="send.php" enctype="multipart/form-data">
  <div class="col-md-4 form-group">
    <label>Nome Completo*</label>
    <input id="nome_completo" name="curriculo[nome_completo]" minlength="5" type="text" class="form-control" placeholder="Nome Completo*">
  </div>
  <div class="row">
    <div class="col-md-12">
      <div class="browse-wrap">
        <div class="title">Anexar Currículo</div>
        <input type="file" id="image1" name="image1" class="upload" title="Anexar Currículo">
      </div>
      <span class="upload-path"></span>
    </div>
  </div>

</form>
    
asked by anonymous 05.07.2018 / 22:48

0 answers