Skip to content Skip to sidebar Skip to footer

HTML Form Submit How To: File Upload And Email

I have an HTML form that have several different fields and drop down menus. The form has several different text fields, a couple drop down menus, and a file upload. Once the form i

Solution 1:

Amm... I don't see "" tag in your code. You must have it when you want to pass data with this form, at the current you just have a nice UI of a form but it doesn't actually work.

<form action="your_php_file.php" method="post" enctype="multipart/form-data">

Please notice that the "enctype" attribute is needed for uploading files, if you just want to send simple inputs you don't need it.


If you just cut those lines off , there are 2 options. 1. Send a URL of the file in the email content. (Easiest) 2. Add the file as an attachment (Check out this code: http://www.texelate.co.uk/blog/send-email-attachment-with-php/)

BTW, instead of having this HUGE condition of checking if "isset", why not writing an array with the field's names and a loop which check each and one of them?


Post a Comment for "HTML Form Submit How To: File Upload And Email"