![]() |
Attaching image file to email form
I am trying to allow users of my website to be able to send and attach files when they use my contact form. I have never actually messed around with this type of thing. But this is going to be kind of essential and help increase my business (hopefully) here is what I have right now this works I just want to add the attach file to it but not sure where to start. Help please?
PHP Code:
|
My first suggestion would be to avoid recreating the wheel. There are libraries out there that make this stupid simple, such as PHPMailer.
That aside, if it's for learning purposes, if you have plans to make this available for your web site, I would work heavily on doing some form validation. You're using unvalidated unfiltered values which opens you WIDE up to a variety of attacks. Don't forgo security in favor of speed to complete an application, ever. You are going to want to look up php file handling, in particular, the $_FILES superglobal that automatically populates with information from a forms file input field. The next thing you are going to want to research is the proper mail headers to attach a file, as the basic headers you are sending above won't permit this. |
| All times are GMT. The time now is 01:17 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0