If I have a plain-text field on a web form (not a file upload) inserting its content into my table, would it be wrong for me to set a mime type 'text' to it, or would it be safer?

  • What's the context of this question? Seems better suited for Stack Overflow since it seems more of a programmatic concern. – jcolebrand Oct 22 '11 at 22:49

MIME types is basically a way of saying "this string of bits should be interpreted/processed as X" so it's equally viable for files and transfers. The more common way of doing this for files is by file extension.

You seem to be asking "is software X doing anything special based on the mime type setting?" without saying what X is.

| improve this answer | |
  • Mahuja, I am not sure if I was clear in my explanation. I was trying to ask: if there's no file, only text input from an internet submission form, should I pretty much never add a MIME type? – Wolfpack'08 Oct 23 '11 at 1:52
  • @Wolfpack'08 I'll reply with a question: What is the user supposed to enter into that field? If it's a name, prose, etc, then it's text/plain and you may mark it as such. If XML, to be parsed as such at some point, is among the valid answers, then you wouldn't want to mark it as text. Of course, this all depends on what the application(s) using the db will do based on the mime type. If they don't even look at it, it doesn't matter what you do. – MaHuJa Nov 13 '11 at 10:01
  • Oh, well that answers it. It's text/plain. Not parsed from XML. – Wolfpack'08 Nov 14 '11 at 8:11

This totally depends on your application. MIME is made for and is most common for E-mail, but it's also common for the web (http) and in some NoSQL databases.

| improve this answer | |
  • Jonas, I was just thinking about making all of my text fields like that for content on a site. For example, I have article content. a.subject, a.body, a.tags, and whatever, you know? I guess my question was overly general, now. I'm getting my bearings on the language and studying at Tizag. I think I should just leave MIME type out? – Wolfpack'08 Oct 23 '11 at 1:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.