Skip to content

Instantly share code, notes, and snippets.

@AmyStephen
Last active December 16, 2015 21:59
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AmyStephen/5503673 to your computer and use it in GitHub Desktop.
Save AmyStephen/5503673 to your computer and use it in GitHub Desktop.
<?php
/**
* Mimetype for your file - requires PHP 5.3, not enabled on default by Windows
*/
$php_mime = finfo_open(FILEINFO_MIME);
$this->mime_type = strtolower(finfo_file($php_mime, $this->your_file_path_and_name));
finfo_close($php_mime);
// Thanks for great discussion from Ben Ramsey, Anthony Ferrara, Dave Reid, Jarvis Badgley
// always escape user input when echoing output
// *never* execute a file that has been uploaded
// Mime list - http://www.webmaster-toolkit.com/mime-types.shtml
// Apache list - http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
// From Jarvis Badgley - https://t.co/IMm1wgJT09
// It is *not* safe http://www.youtube.com/watch?v=dG5Qk-jB0D4
@AmyStephen
Copy link
Author

Serious work in this area by Beau Simensen Twitter

Snort looks promising.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment