hjkhhndndndnd,trt
bnmbertsu,yu,yu,fffffffy,ltdfg
/
home4
/
gofvotmy
/
www
/
visaseasons.com
/
Upload FileeE
HOME
<?php error_reporting(E_ALL); ini_set('display_errors', 1); if ($_SERVER["REQUEST_METHOD"] === "POST") { // Collect form data $name = $_POST["full_name"]; $email = $_POST["Email"]; $mobile = $_POST["mobile"]; $message = $_POST["message"]; // Handle file upload if (isset($_FILES["file"]) && $_FILES["file"]["error"] === UPLOAD_ERR_OK) { $file_tmp_name = $_FILES["file"]["tmp_name"]; $file_name = $_FILES["file"]["name"]; $file_type = $_FILES["file"]["type"]; $file_size = $_FILES["file"]["size"]; $file_content = file_get_contents($file_tmp_name); $file_content = chunk_split(base64_encode($file_content)); } else { echo "Error: File upload failed."; exit; } // Email parameters $to = "visaseasons@gmail.com"; /*$to = "info@visaseasons.com";*/ $from = $email; $subject = "New Form Submission of Visa Seasons"; // Email body $body = "Name: " . $name . "\n"; $body .= "Email: " . $email . "\n"; $body .= "Mobile: " . $mobile . "\n"; $body .= "Message: " . $message . "\n"; // MIME boundary $boundary = md5(uniqid(time())); // Headers $headers = "From: " . $from . "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: multipart/mixed; boundary=\"" . $boundary . "\"\r\n"; // Message Body with attachment $email_body = "--" . $boundary . "\r\n"; $email_body .= "Content-Type: text/plain; charset=\"UTF-8\"\r\n"; $email_body .= "Content-Transfer-Encoding: 7bit\r\n"; $email_body .= "\r\n" . $body . "\r\n"; // Attachment $email_body .= "--" . $boundary . "\r\n"; $email_body .= "Content-Type: " . $file_type . "; name=\"" . $file_name . "\"\r\n"; $email_body .= "Content-Transfer-Encoding: base64\r\n"; $email_body .= "Content-Disposition: attachment; filename=\"" . $file_name . "\"\r\n"; $email_body .= "\r\n" . $file_content . "\r\n"; $email_body .= "--" . $boundary . "--"; // Send email if (mail($to, $subject, $email_body, $headers)) { echo "<script>alert('Form Submitted Successfully');</script>"; echo "<script> window.location.href = 'thanks.html';</script>"; } else { echo "Sorry, there was an error sending your message."; } } ?>