I was looking everywhere but couldn't find exactly what I want. So the problem is that I have a contact form with an upload input and after someone clicks Submit button I need that uploaded file (in particular picture) to be attached to an email and sent, after that immediately deleted. Soo as far as I know any uploaded file does get stored in my /var/www/tmp folder under certain name BUT how do I get that file attached if it has name without any extension?
Thanks for you help.
so here's my code. But it only sends that temporary uploaded file without any extension, so how can get sent the actual uploaded file for example image.png without uploading it forever:
foreach($_FILES['files']['tmp_name'] as $key => $tmp_name ){
if(!empty($_FILES['files']['tmp_name'][$key])){
$mail->addAttachment($_FILES['files']['tmp_name'][$key]); // Add attachments
}
}