Send attachments via wp_mail from temporary folder

Is it possible to send attachment via wp_mail, using temporary file, instad of uploading them to any actual folder on server?

For example:

input type="file" name="file"

$attachment[] = $_FILES['file']['name'];

wp_mail(....,$attachment);

Documentation:

The filenames in the $attachments attribute have to be filesystem paths.

How can i get the path for temporary file (if this is possible)?

Topic wp-mail input uploads Wordpress

Category Web


Yes. it's possible. Attachment file contents are taken by wp_mail call.

Use $_FILES['file']['tmp_name'] for filename

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.