Forum Moderators: open
In an application i'm making, sometimes the form contains uploads, but most of times not. So I have to make a switch for this form property: when there is an upload, it should have the above code. To make this switch is a hassle, so I'm wondering if there is a reason (security-wise) for not using the full
<form name="formname" method="post" action="jajaja.php" enctype="multipart/form-data">
for all forms, also the once not having uploads?
[edited by: tedster at 9:38 pm (utc) on Oct. 31, 2007]
However, the server-side is where you can save a few bytes.
A multipart form can contain any data type in it's multiple parts, text, binary, whatever. These are determined when it's parsed out.
To parse out a multipart form, you usually need a bit more programming to do the grunt work. In perl, this is done using the CGI module, which contains a LOT of other code and functions.
If file upload is the only use you have for multipart forms, it's just extra weight to carry around for every request to your programs that aren't parsing out multipart input. It's a matter of economy, for forms that don't use a multipart, I use a more compact read/parse routine.