Jump to content

[SOLVED] need help mime types cheers........


redarrow

Recommended Posts

Advance thank you......

 

I am currently on a big project,at the end but i need to no

what mime type is the most used for .exe files.....

 

this is an example off all the mime types for .exe excutiable files.....

 

application/octet-stream

application/x-msdownload

application/exe

application/x-exe

application/dos-exe

vms/exe

application/x-winexe

application/msdos-windows

application/x-msdos-program

 

this is for a upload form so the user dosent get to post a .exe file.....

 

current code not working!

 



<?php

$_FILES['usefile']['name']='redarrow.exe';


$x=array(
"application/octet-stream",
"application/x-msdownload",
"application/exe",
"application/x-exe",
"application/dos-exe",
"vms/exe",
"application/x-winexe",
"application/msdos-windows",
"application/x-msdos-program"
);

foreach($x as $b){

if ($_FILES['usefile']['type']==$b)die("You cannot upload exe files. I'm reporting you to the FCC!");

if (stristr($_FILES['usefile']['type'],'.exe'))die("You cannot upload exe files. I'm reporting you to the FCC!");

}
?>

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/126773-solved-need-help-mime-types-cheers/
Share on other sites

 

This done it cheers........

<?php

$_FILES['usefile']['name']='redarrow.exe';


$x=array(
"application/octet-stream",
"application/x-msdownload",
"application/exe",
"application/x-exe",
"application/dos-exe",
"vms/exe",
"application/x-winexe",
"application/msdos-windows",
"application/x-msdos-program",
".exe"
);


if( in_array($_FILES['usefile']['type'],$x) || 
substr($_FILES['usefile']['name'],-4)) die('Nope!');

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.