andre1990 Posted November 3, 2011 Share Posted November 3, 2011 Can this be done easily enough with php? I've attached my current code below, but don't see how i could add this in. $name = $_FILES['file']['name']; $temp = $_FILES['file']['tmp_name']; $size = $_FILES['file']['size']; $random = md5(uniqid(rand(), true)); $random = substr($random, 0, 20); if (!$name || !$temp || !$size) { echo "Go back and select a file."; exit(); } foreach ($_FILES as $file) { if ($file['tmp_name'] != null) { $thisext1=explode(".", strtolower($file['name'])); $thisext=$thisext1[count($thisext1)-1]; if (!in_array($thisext, $extensions)) { echo "That file type is not allowed."; exit(); } } } Quote Link to comment https://forums.phpfreaks.com/topic/250398-how-to-block-the-word-php-from-file-name/ Share on other sites More sharing options...
floridaflatlander Posted November 3, 2011 Share Posted November 3, 2011 Can you use str_replace() ? Quote Link to comment https://forums.phpfreaks.com/topic/250398-how-to-block-the-word-php-from-file-name/#findComment-1284756 Share on other sites More sharing options...
Pikachu2000 Posted November 3, 2011 Share Posted November 3, 2011 if( stripos($filename, 'php') !== FALSE ) { // filename contains the string 'php' in it. } Quote Link to comment https://forums.phpfreaks.com/topic/250398-how-to-block-the-word-php-from-file-name/#findComment-1284759 Share on other sites More sharing options...
andre1990 Posted November 3, 2011 Author Share Posted November 3, 2011 Thank you very much, did the trick wonderfully! Quote Link to comment https://forums.phpfreaks.com/topic/250398-how-to-block-the-word-php-from-file-name/#findComment-1284767 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.