best way to generate file name in php code example Example: create unique filename php $filename = uniqid(rand(), true) . '.pdf';