samuraibsd Posted January 27, 2008 Share Posted January 27, 2008 Hi, all This is my first post, so please go easy on me I've got a little problem. I have a PHP upload form that works flawlessly, but I need a contact form to go with it. I'd like to have fields for Name, email address and message. That in itself isn't hard, but what I'm unsure of is how to attach the file upload script to the contact form in such a way that the email is sent to the address, and the file is uploaded to a specific server – that is, NOT sent as an attachment with the email (these files are rather large, though I'm capping it off at 200 MB). I'd also like to have the email sent read something like "[the file] was sent by [sender's name] from [sender's email]" I think I know how to do that bit, but just in case I'm wrong, you know? Any help is appreciated, thanks guys! Quote Link to comment https://forums.phpfreaks.com/topic/88012-contact-form-help-may-be-weird/ Share on other sites More sharing options...
CMC Posted January 27, 2008 Share Posted January 27, 2008 Well just incorporate the required fields for the email and add them to your current uploading form and then just add in the mail function in your script. ex form: Name:<input type="text" name="name" maxlength="50" /><br /> Email:<input type="text" name="email" maxlength="100" /><br /> <textarea name="message"></textarea><br /> File:<input type="file" name="file" /><br /> <input type="submit" name="upload" value="upload" /> Then just add the appropriate variables and functions to your upload script, which will most likely have the following format <?php if(isset($_POST['upload'])){ being uploading file /*now add in the part for the email*/ $to = $_POST['emai']; $subject = "Download file!"; $message = $_POST['message']; $message .= "The {$filename} was sent by {$_POST['name']} from {$_POST['email']}"; $headers = "From: $_POST['name']"; //lets mail it mail($to,$subject,$message,$headers); } Very basic example, but I think it will show you the point. If not, post your code and I can help you further. ?> Quote Link to comment https://forums.phpfreaks.com/topic/88012-contact-form-help-may-be-weird/#findComment-450314 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.