Form Tag Attribute for Uploading Files
If you build a form to upload a file, the form
tag's attributes must include this:
enctype="multipart/form-data"
If it's not present, the form won't upload any files.
When the form is not used to upload files, the enctype
attribute in the form
tag is optional. If specified, the enctype
attribute may have any of these values:
application/x-www-form-urlencoded multipart/form-data text/plain
If a form
tag has no enctype
attribute specified, application/x-www-form-urlencoded
is default. But the default value won't work to upload files; it is the wrong value for that.
For reference, here is an example form
tag.
<form method="post" enctype="multipart/form-data" action="form-submission.php">
(This blog post first appeared in Possibilities newsletter.)
Will Bontrager