I am creating a simple form that allows the user to “upload” a file and a comment field. after the user selects a file (maybe an image or a PDF) and click "Submit", I am not going to store the file on my web server, the file will be inserted into the email and sent to me.
My question is: how can I attach a file without saving it anywhere.
I do not want to use a third-party module.
Update:
$attachment = $_FILES["OrderList"]["tmp_name"]; $content = file_get_contents($attachment); $content = chunk_split(base64_encode($content));
There was an error:
The file name cannot be empty in C: \ dir \ orders \ upload.php on line 24
line 24 $content = file_get_contents($attachment);
source share