html form with mixed input tags (type= file and others)
I just wanted to discuss a topic which I am thinking about. I work on a java application with struts and I am facing a fact that I have to implement a new input field type file. The thing is, that on the form where we are operating is already full with input fields.. This means we have to mix up diffren开发者_运维技巧t input tags and as well I have to set enctype to multipart/text-form. Istead of creating a special form for this file input I just changed the only one form we have to enctype multiform/form-data.
Now the question from what I like to hear some impressions is what you think about handling all input's with mutliform/form-data? What I already know is that the requests get larger but if this is the only bad thing I can live with it.
Thanks for any input.
Cheers Chris
multipart/form-data does add a bit more overhead, because the browser's essentially building and sending a MIME message. This is to allow the file(s) portion of the submission to be kept seperate from the rest of the form fields being submitted.
In comparison, a regular POST form is essentially the same as a GET, except the form data is passed within the body of the POST request, rather than as query parameters.
Any modern server-side processing language (PHP, Perl, Ruby, Python, etc...) will handle all the details of extracting the POST data, regardless of how it was uploaded. Unless you have to deal with the raw bytes yourself, you'd never really need to know how it was upload - things will just "work".
精彩评论