PHP code example of indiehd / filename-sanitizer
1. Go to this page and download the library: Download indiehd/filename-sanitizer library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
indiehd / filename-sanitizer example snippets
use IndieHD\FilenameSanitizer\FilenameSanitizer;
// Add illegal characters and a null-byte at the end of the name.
$sanitizer = new FilenameSanitizer('On / Off Again: My Journey to Stardom.jpg' . chr(0));
$sanitizer->stripIllegalFilesystemCharacters();
// The resultant string is free of the offending characters.
var_dump($sanitizer->getFilename());
// Output:
// "On Off Again My Journey to Stardom.jpg"
$sanitizer = new FilenameSanitizer(' malicious_function();