This article shows you how to create a PHP based email form that supports file attachment. The article will also show you how to validate the type and size of the uploaded file. The HTML form with file upload box The code for an HTML form with a file upload box is given below. User can click on the ‘Browse’ button to select the file from his/her local machine. <form method="POST" name="email_form_with_php" action="php-form-action.