MIME type of programs written in C (.c or c ++) language in PHP

0

I have the doubt of which is MIME in PHP of the programs written in C language either .co c ++ what happens is that in my application I need that they can only upload files with that extension, I want to make a filter something like this:

if( $_FILES['archivo']['type']=='image/png') but for extension .c or c ++

    
asked by Yept 24.01.2018 в 09:53
source

1 answer

1

Try this:

  

For C

if($_FILES['archivo']['type']=='text/x-c')
  

For C ++

if($_FILES['archivo']['type']=='text/plain')

In addition, we have ways to know the MIME of a file:

$mime = new finfo;

$filemime = $mime->file($tufichero, FILEINFO_MIME);

Greetings,

    
answered by 24.01.2018 / 10:22
source