See the existing image upload code for some usable patterns. This doesn't report any error messages if the wrong file type is uploaded. (OTOH some of the other fields should be validated as well. The form is missing a validate() function.)