Jump to content

Search the Community

Showing results for tags 'multiple attachments'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hi Everyone! I'm new to php and am trying to get to a specific place an not having much luck! I (ideally) would like to be able to upload 3 image files on a webpage and have my php script resize it and then add it as 3 attachments with a load of other info in an email.... Its driving me a little insane though! I can't seem to get this code to fit with some resizing code, If you more experienced guys could point me in the right direction that would be awesome! I think i can get something in that for loop to resize as it attaches but everything i try messes up! <?php if($_POST['formSubmit'] == "Submit") { if($_POST['text_question'] == "" || $_POST['text_name'] == "" || $_POST['text_email'] == "") { header("Location: back.html"); }else{ $from = $_POST['text_email']; $to = "alex@camppontiac.com"; $subject = "Website Consultation"; $message = ($_POST['text_question']); $message .= "\n----------------\n"; $message .= "From: \n" . $_POST['text_name'] . "\nE-mail address: \n" . $_POST['text_email'] . "\nPhone Number:\n" . $_POST['text_phone']; $headers = "From: " . $_POST['text_name'] . " <" . $_POST['text_email'] . ">"; $dir = "/tmp"; $dh = opendir($dir); while (false !== ($filename = readdir($dh))) { $files[] = $filename; } // include the from email in the headers $headers = "From: $from"; // boundary $time = md5(time()); $boundary = "==Multipart_Boundary_x{$time}x"; // headers used for send attachment with email $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$boundary}\""; // multipart boundary $message = "--{$boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; $message .= "--{$boundary}\n"; // attach the attachments to the message for($x=0; $x<count($files); $x++){ $files = fopen($files[$x],"w+"); $content = fread($file,filesize($files[$x])); fclose($file); $content = chunk_split(base64_encode($content)); $message .= "Content-Type: {\"application/octet-stream\"};\n" . " name=\"$files[$x]\"\n" . "Content-Disposition: attachment;\n" . " filename=\"$filenames[$x]\"\n" . "Content-Transfer-Encoding: base64\n\n" . $content . "\n\n"; $message .= "--{$boundary}\n"; } // sending mail if(@mail($to, $subject, $message, $headers)== true) { header("Location: confirm.html"); } else { header("Location: back.html"); } }} ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.