Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_POST['submit']))
- {
- //The form has been submitted, prep a nice thank you message
- $output = '<h1>Thanks for your file and message!</h1>';
- //Set the form flag to no display (cheap way!)
- $flags = 'style="display:none;"';
- //Deal with the email
- $to = 'xxxx@gmail.com';
- $subject = 'Details and file attachments ';
- $message = strip_tags($_POST['message']);
- $attachment = (file_get_contents($_FILES['file']['tmp_name']));
- $filename = $_FILES['file']['name'];
- $boundary =md5(date('r', time()));
- $headers = "From: xxxxxx@gmail.comrnReply-To: xxxxxxx@gmail.com";
- $headers .= "rnMIME-Version: 1.0rnContent-Type: multipart/mixed; boundary="_1_$boundary"";
- $message="This is a multi-part message in MIME format.
- --_1_$boundary
- Content-Type: multipart/alternative; boundary="_2_$boundary"
- --_2_$boundary
- Content-Type: text/plain; charset="iso-8859-1"
- Content-Transfer-Encoding: 7bit
- $message
- --_2_$boundary--
- --_1_$boundary
- Content-Type: application/octet-stream; name="$filename"
- Content-Transfer-Encoding: base64
- Content-Disposition: attachment
- $attachment
- --_1_$boundary--";
- mail($to, $subject, $message, $headers);
- }
- ?>
- <td height="12"> <?php echo $output; ?>
- <form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" <?php echo $flags;?>>
- <fieldset>
- <legend>Submit your interest</legend>
- <p><label class="title" for="name">Your name:</label>
- <input type="text" name="name" id="name"><br /></p>
- <p> <label class="title" for="email">Your email:</label>
- <input type="text" name="email" id="email"></p>
- <p> <label class="title" for="phone">Your phone:</label>
- <input type="number" name="phone" id="phone"></p>
- <p><label for="location" class="title">Total Experience :</label>
- <select name="location" id="location">
- <option value="ny">1</option>
- <option value="il">2</option>
- <option value="ca">3+</option>
- </select></p>
- <span class="title">Upload your resume</span>
- <input type="file" name="resume" />
- </p>
- </fieldset>
- <div><input type="submit" name="submit" id="submit" value="send"></div>
- </form></td>
- http://www.html-form-guide.com/email-form/php-email-form-attachment.html/
- Content-Transfer-Encoding: base64
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement