0

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
    }
}
Povilas Samitovas
  • 85
  • 1
  • 4
  • 13

1 Answers1

0

I think you are handling the upload process incorrectly, as you should be handling the naming of the file and making sure the extension is correctly set. See this post, I think ti will help you solve this issue:

Finding Extension of uploaded file (PHP)

Community
  • 1
  • 1
Geoherna
  • 3,523
  • 1
  • 24
  • 39
  • Thanks for you answer but unfortunately no luck yet.. I've checked your link and I still haven't solved my problem. I've edited my post, check it now. – Povilas Samitovas Aug 23 '15 at 10:56