Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sql file extension type

Tags:

php

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.

like image 961
Ofir Attia Avatar asked Jan 10 '13 22:01

Ofir Attia


People also ask

Is a .SQL file a database?

A SQL file contains Structured Query Language (SQL), which is a language used to access and modify information in a database. It stores SQL statements for creating or modifying database structures, insertions, updates, deletions, or other SQL operations.

What is a SQL script file?

The SQL script file is a container for SQL statements or commands. When you run SQL statements from a client such as JSqsh, the script file is a convenient way of manipulating large numbers of statements.

How do I format a SQL file?

With all of the objects scripted out as ALTER statements, in a single query window, simply choose SQL Prompt's Format SQL option, or use the Ctrl+K, Ctrl+Y shortcut, in order to format the script in the desired manner.


1 Answers

The official answer according to IANA is application/sql. See http://www.iana.org/assignments/media-types/media-types.xhtml and https://www.rfc-editor.org/rfc/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.

like image 160
Vroo Avatar answered Sep 18 '22 19:09

Vroo