Create tmp file from string
$string = 'random string'; $file = tempnam(sys_get_temp_dir(), 'POST'); file_put_contents($file, $string);
https://stackoverflow.com/a/6150017/2618535