Answers for "save temporary image in php"

PHP
3

php create temporary file

// Works on Native Server
// $tmp = tmpfile();
// $newfilename = 'newfile.txt';
// fwrite($tmp, "This is a sample string as a content.");
// fseek($tmp, 0);

// Works on Google App Engine
$dir = sys_get_temp_dir();
$tmp = tempnam($dir, "foo");
file_put_contents($tmp, "hello");
//$f = fopen($tmp, "a");
//fwrite($f, " world");
//fclose($f);
//echo file_get_contents($tmp);
Posted by: Guest on June-18-2020
0

PHP temporary files

# Creates a file and returns the handle.
$temp = tmpfile();
fwrite($temp, "Hello, World!");
fclose($temp);
Posted by: Guest on February-19-2022

Browse Popular Code Answers by Language