Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8395425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:17:51+00:00 2026-06-09T20:17:51+00:00

I am trying to have a php mailer code attach a file along with

  • 0

I am trying to have a php mailer code attach a file along with the regular information. I don’t know what to do. Here is how far I have come.

Form.html

<form method="post" name="contact" action="contactprocessor.php">
<label for="name">Name: </label> <input type="text" id="name">
<label for="email">email: </label> <input type="email" id="email">
<label for="file">Upload file: </label> <input type="file" id="file">
<input type="submit" id="name" value="upload">

contactprocessor.php

<?php 
$emailSubject = 'file upload';
$mailto ='me@mymail.com';
$nameField = $_POST['name'];
$emailField = $_POST['email'];
$body = <<<EOD 
NAME: $name <br>
Email: $email <br>
EOD;
$headers = "from: $email\r\n";
$success = mail($mailto, $emailSubject, $body, $headers);
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T20:17:53+00:00Added an answer on June 9, 2026 at 8:17 pm

    Unfortunately, you can’t send file with email directly. I recommend to use phpmailer class (http://code.google.com/a/apache-extras.org/p/phpmailer/) but also there is a traditional way: http://webcheatsheet.com/php/send_email_text_html_attachment.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to have my PHP script return some SQL table queries. Here's my script
I have a php file that I am trying to send the output in
I have this php code, with which I am trying to generate a popup
I am trying to have PHP read an XML file and then convert it
I have php file from which i am trying to run firefox and getting
I'm trying to find the security code in this php for a mailer. Please
I have PHP issue, I'm trying to force a file download using php if
Ok so im trying to have php check if the date on file is
Iam trying to find the setting, where i can have PHP execute other file
I have a PHP upload script and am trying to make it so that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.