How to upload files from this form to the form that sends the message. Currently, the message is being sent, but no files I can't pass values from JS to a form in
My website: https://fck-auto.de/ankaufahrzeuge/
FORM: https://jsfiddle.net/alexjamesbrown/2nzL9f7g/
PHP CODE:
if(count($_FILES['upload']['name']) > 0){
$rand = rand();
$createFolder = uniqid();
mkdir('uploads/'.$createFolder);
for($i=0; $i<count($_FILES['upload']['name']); $i++) {
$tmpFilePath = $_FILES['upload']['tmp_name'][$i];
if($tmpFilePath != ""){
$shortname = $_FILES['upload']['name'][$i];
$explode = explode(".", $_FILES['upload']['name'][$i]);
$filePath = "uploads/".$createFolder. '/' . rand().'.'.$explode[1];
if(move_uploaded_file($tmpFilePath, $filePath)) {
$files[] = $shortname;
}
}
}
}