отправляется только строка "array"
<form action="POST" class="contacts-form" id="formFile">
<label class="label-input-wrapper">
<input name="name" id="input-name" type="text" autocomplete="off" required>
</label>
<label class="label-input-wrapper">
<input name="number" id="input-phone" type="text" autocomplete="off" required>
</label>
<label class="label-input-wrapper">
<input name="mail" id="input-mail" type="text" autocomplete="off">
</label>
<label class="label-input-wrapper">
<input name="input-file" id="input-file" type="file" autocomplete="off" required>
</label>
<button class="btn btn-contacts-form">Отправить</button>
</form>
$(function() {
$("#formFile").submit(function(e) {
e.preventDefault();
var $that = $(this),
formData = new FormData($that.get(0));
return $.ajax({
url: "https://site/mail-file.php",
type: "POST",
data: formData,
contentType: false,
processData: false,
success: function() {
jQuery("#formFile")[0].reset();
}
}), !1
})
})
<?php
$to = '';
$subject = 'Новая заявка с сайта';
$message = "Имя: {$_POST['name']}\r\n
Почта: {$_POST['mail']}\r\n
Номер: {$_POST['number']}\r\n
{$_FILES['input-file']}";
define( 'WP_USE_THEMES', false );
require( 'wp-load.php' );
$sent_message = wp_mail( $to, $subject, $message );
?>