Skip to content

Instantly share code, notes, and snippets.

@AndrewChamp
Last active December 24, 2018 06:15
Show Gist options
  • Save AndrewChamp/5859882 to your computer and use it in GitHub Desktop.
Save AndrewChamp/5859882 to your computer and use it in GitHub Desktop.
Replace illegal characters from file upload name.php
<?php
$bad = array_merge(array_map('chr', range(0,31)), array("<", ">", ":", '"', "/", "\\", "|", "?", "*", " "));
$result = str_replace($bad, "-", $filename);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment