All posts tagged in: PHP

Sanitize filenames with PHP

PDF generation and invalid characters While working with the TableTools PDF generator included in the great DataTables jQuery plugin I've noticed that sometimes the script failed to generate the PDF file. The cause? Invalid characters in the filename. Well, to solve this issue I've made a simple PHP function to…

Check UTF-8 input in PHP: only letters

This is a simple way to check a UTF-8 string with PHP function preg_match in search for anything that isn't a letter, which includes all UTF-8 letters and not just ASCII. Preg_match performs a regular match on the given input using a pattern. The pattern used tells preg_…

How to prevent caching (force image reload) in PHP and/or JavaScript/jQuery

If you are using images generated on-the-fly by a PHP script (or another server language), like I'm doing on my web application, you surely do not want images to be read from cache as your users will be seeing the same first generated image (saved into cache) and not the…