views:

34

answers:

1

I am able to attach a file using SwiftMailer with its name hardcoded. But what if the file is uploaded by a user from an HTML form's 'file input type control and has to be sent with an email by a PHP script? How do I specify the file name in SwiftMailer?

Thank you!

A: 

I'm pretty sure in this case you could use the $_FILES['file']['tmp_name'] value. This gives the path to the temporary uploaded file.

Programasaurus
Also, if you want to keep the file on your server, just use the move_uploaded_file() function and then pass your destination path to SwiftMailer.
Programasaurus
Somehow it didn't work or perhaps I'm doing something wrong.Will have to try it again in the morning, with my head fresh.Thank you!
vlevsha