Search the Community
Showing results for tags 'wireupload wiremail image'.
-
Hi, I am getting close to finishing the form I've been working on. My goal is to have users upload an image in the form, and have that image be sent along with the rest of the email content. Taking code from a suggested thread, I am able to get the user uploaded image into my assets folder (which is in the code below). So I can at least receive the image... but I would like for that image to be sent in the content of the email instead. Would I be able to modify my code to do that? The section of the script that sends the image to the assets folder starts with //image upload begin: <?php $email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL); $email .= $_REQUEST['email']; if (isset($_POST['submit']) and ($_POST['email']) and ($_POST['comments']) ) { //image upload begin $upload_path = $config->paths->assets . "files/useruploads/"; $user_image = new WireUpload('user_image'); // References the name of the field in the HTML form that uploads the photo $user_image->setMaxFiles(5); $user_image->setOverwrite(false); $user_image->setDestinationPath($upload_path); $user_image->setValidExtensions(array('jpg', 'jpeg', 'png', 'gif')); // execute upload and check for errors $files = $user_image->execute(); //image upload end $to = 'me@email.com'; $subject = 'Feedback from my site'; $message = 'Name: ' . $sanitizer->text($input->post->name) . "\r\n\r\n"; $message .='Email: ' . $sanitizer->email($input->post->email) . "\r\n\r\n"; $comments = $sanitizer->entities($sanitizer->textarea($input->post->comments)); $message .= 'Comments: ' . $comments; $success = $email; $success .=$message; $mail = wireMail(); $mail->to($to)->from('me@email.com'); $mail->subject($subject); $mail->body($message); $mail->send(); } else { header("location: error-page"); exit; } ?> <form id="option3form" action="./" method="post" enctype="multipart/form-data" target="_blank"> <label for="name">Name: </label> <input type="text" name="name" id="name"> <label for="email">Email: </label> <input type="email" name="email" id="email"><br /><br /> <label for="comments">Comments: </label> <textarea name="comments" id="comments"></textarea><br /><br /> <p>Click the "Choose File" button below to upload your image.</p> <input type="file" name="user_image" /> <input type="submit" name="submit" value="Submit"> </form> Thanks!