Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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);
Source by www.php.net #
 
PREVIOUS NEXT
Tagged: #php #create #temporary #file
ADD COMMENT
Topic
Name
4+9 =