Dynadot

SQL mime type

Spaceship Spaceship
Watch

SiKing

Registered MemberEstablished Member
Impact
6
Just a quickie. I was just need to know what mime type I should use to upload .sql files. I'm currently using 'text/plain' for .txt files. Thanks
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Using text/plain is correct. It doesn't really matter too much though...the main purpose of specifying the mime type is for the browsers to know what to do w/ the file, unless ya have a script that looks at the mime type or something on uploads.
 
0
•••
Yeah, sorry - I should have made that clear. Its a script which handles uploads. I need it to verify it's a .sql file rather than a .txt file. Thanks
 
0
•••
You can try application/x-sql as the mimetype. I don't know how well supported that is though...
 
0
•••
using an sql mime type just isnt going to work unless the user uploading has used a specific SQL editor that can support it. when im working with SQL queries i use notepad and just save as plain text.

i think you need to open the document up on the server and validate some part of it like check that you can find either an INSERT, DELETE, UPDATE and SET (

stuff like that otherwise its just not going to work.
 
0
•••
Awesome, thanks for the help Adam and monaco. I'll just stick to .txt documents
 
0
•••
0
•••
Check the ext to see if it's .sql. Of course it's not guaranteed to contain plain text (if it will be used by someone else than you). Also, I don't recommend relying too much on the MIME type because it it set by the browser and sometimes you may get unexpected MIME descriptors.
 
0
•••
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back