Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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?

share|improve this question

closed as off topic by Mark Storey-Smith, Aaron Bertrand, Leigh Riffel, Marian, Nick Chammas Oct 21 '12 at 14:07

Questions on Database Administrators Stack Exchange are expected to relate to database administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
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
add comment

2 Answers

up vote 2 down vote accepted

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.

share|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
add comment

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.

share|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
add comment

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