enemeth Posted April 14, 2008 Share Posted April 14, 2008 Hi there, I need some help with this code, <form method="POST" action="--WEBBOT-SELF--"> <!--webbot bot="SaveResults" U-File="fpweb:///_private/form_results.txt" S-Format="TEXT/CSV" S-Label-Fields="TRUE" --> <p><input type="text" name="T1" size="20"></p> <p> </p> <input type="file" name="attachment" id="attachment" onchange="document.getElementById('moreUploadsLink').style.display = 'block';" /> <div id="moreUploads"></div> <div id="moreUploadsLink" style="display:none;"><a href="javascript:addFileInput();">Attach another File</a></div> <script language="JavaScript"> var upload_number = 2; function addFileInput() { var d = document.createElement("div"); var file = document.createElement("input"); file.setAttribute("type", "file"); file.setAttribute("name", "attachment"+upload_number); d.appendChild(file); document.getElementById("moreUploads").appendChild(d); upload_number++; } </script> <p> </p> <p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p> </form> this is as you see a typical form that you can attach a file to , which is good , but i need some help in getting that attachment emailed to my email address, any one can help me ? Thx , Elaine Quote Link to comment Share on other sites More sharing options...
mrdamien Posted April 14, 2008 Share Posted April 14, 2008 Start yourself off with this: Email: http://ca3.php.net/manual/en/function.mail.php File upload: http://ca3.php.net/manual/en/features.file-upload.php We help you with your code, we don't write it all for you. Quote Link to comment Share on other sites More sharing options...
umer_lala Posted April 14, 2008 Share Posted April 14, 2008 1- class.phpmailer.php 2- class.smtp.php Download these both files from http://sourceforge.net/project/showfiles.php?group_id=26031 or from here http://phpmailer.codeworxtech.com/ include these both file in your index page and use this code in index file $mail = new phpmailer(); $mail->From = $FromName; $mail->FromName = ""; $mail->Subject = ""; $mail->Body = $strMessage; $mail->AddAddress($row["fld_email"], ""); $mail->AddAttachment($path, $file_url); if(!$mail->Send()) echo "There has been a mail error"; else echo"Mail have been send "; //Clear all addresses and attachments for next loop $mail->ClearAddresses(); $mail->ClearAttachments(); } Quote Link to comment 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.