PHP tempnam() Function

In the tempnam() function is used to create temporary file with single filename and which returns two outputs are TRUE and FALSE .in the TRUE means success and FALSE means failure.

Demo :



Temporary File Name :  
       

Example :

In the above demo just you enter temporary file name at text box and then click create button now will be created temp file.if you would like to see that temp file at window machine go to start -> Run to type %temp% and then click ok button there is available temp file otherwise if you use linux machine go to /tmp directory and see that temp files.

Code :

Following code is use to tempnam() function if you need code to copy and use to your website.


<?php
  $temp_name = 'temp_name';
  $filename = tempnam("/tmp",$temp_name);
  echo Temporary file [$filename] successfully created";
?>

In the above example $temp_name variable is used to assign for tmp name and tempnam() function is used to create a tmp file at operating system and which function two argument first one string directory and second one is string prefix. The string directory argument is used to pass for directory name and string prefix argument is used to add prefix for tmp file.

Free Download Script :

If you need to tempnam() function code click and download from following link.

Download




Content