![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Industry Role:
Join Date: Aug 2003
Location: Canada
Posts: 2,310
|
![]() i would like to send 10 image files from my html form to php but having some problems & i've been searching google all day with no solid leads & was hoping that someone here would know because i know this has been done many times before. here's my php code:
Code:
<?php // Read POST request params into global vars $name = $_POST['name']; $to = $_POST['to']; $email = $_POST['email']; $subject = $_POST['subject']; // Obtain file upload vars $fileatt1 = $_FILES['fileatt1']['tmp_name']; $fileatt1_type = $_FILES['fileatt1']['type']; $fileatt1_name = $_FILES['fileatt1']['name']; // THIS HAS BEEN REPEATED AND I HAVE CHANGED THE FILE NAME $fileatt2 = $_FILES['fileatt2']['tmp_name']; $fileatt2_type = $_FILES['fileatt2']['type']; $fileatt2_name = $_FILES['fileatt2']['name']; $headers = "From: $email"; if (is_uploaded_file($fileatt1)) { // Read the file to be attached ('rb' = read binary) $file1 = fopen($fileatt1,'rb'); $data1 = fread($file1,filesize($fileatt1)); fclose($file1); } if (is_uploaded_file($fileatt2)) { // Read the file to be attached ('rb' = read binary) $file2 = fopen($fileatt2,'rb'); $data2 = fread($file2,filesize($fileatt2)); fclose($file2); } // Generate a boundary string $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; // Add the headers for a file attachment $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; // Add a multipart boundary above the plain message $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . "Name: " . $name . "\n\n" . "Email: " . $email . "\n\n" ; // Base64 encode the file data $data1 = chunk_split(base64_encode($data1)); $data2 = chunk_split(base64_encode($data2)); // Add file attachment to the message $message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt1_type};\n" . " name=\"{$fileatt1_name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt1_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data1 . "\n\n" . "--{$mime_boundary}--\n"; // THIS HAS BEEN REPEATED $message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt2_type};\n" . " name=\"{$fileatt2_name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt2_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data2 . "\n\n" . "--{$mime_boundary}--\n"; // Send the message $ok = @mail($to, $subject, $message, $headers); if ($ok) { echo "<p>Thank you <b>$name</b></p> <p>We have received your application and we will be in touch shortly</p>"; } else { echo "<p>Sorry, but there as an error. If the problem persists please email us at </p>"; } ?> |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Industry Role:
Join Date: Jun 2004
Location: New York, NY
Posts: 6,890
|
You should start using PEAR, it's great for all kinds of things
![]() Example: PHP Code:
__________________
Skype variuscr - Email varius AT gmail |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Totally Borked
Industry Role:
Join Date: Feb 2005
Posts: 6,284
|
not php, but I like dhtmlxVault
__________________
![]() For coding work - hit me up on andy // borkedcoder // com (consider figuring out the email as test #1) All models are wrong, but some are useful. George E.P. Box. p202 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Join Date: Nov 2004
Location: scv
Posts: 2,299
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Industry Role:
Join Date: Aug 2003
Location: Canada
Posts: 2,310
|
thx for the help guys & thx varius for the instant msger help!
these include classes are new to me... very interesting stuff! ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |