Sql文件扩展名类型

What is the sql extension type?
I want to upload to some folder in my server only .sql files.
I know that for txt is text/plain. what is for sql files?

 if($_FILES['userfile']['type'] != 'THE SQL EXTENSION'){
    echo ' File is not an sql file.';
    exit;
}

thanks.

There is no special MIME type for SQL. Just use application/octet-stream.

See @Vroo's answer below (application/sql). Since RFC6922 was published, this answer is no longer correct.

Find out what return $_FILES['userfile']['type']

replace echo ... with echo $_FILES['userfile']['type'];

There is no way to check if it's an SQL file simply on the basis of MIME-types. SQL-files are text/plain, as others already pointed out. You would have to perform some checks on the incoming file (like running a regex which check's for SQL commands, or even running a parser/checker, if one is available in PHP), if you want to be sure only SQL files are uploaded.

The official answer according to IANA is application/sql. See http://www.iana.org/assignments/media-types/media-types.xhtml and http://tools.ietf.org/html/rfc6922

However, since lots of people don't bother to read documentation you might also want to accept text/sql, text/x-sql and text/plain.