Searching...
Monday 8 October 2012

PHP TmpFile

10:36 pm

PHP TmpFile

tmpfile():  this function creates a temporary file with a unique name in read/write(w+) mode, no arguments for this function.temporary files will be available only when the program is running, once the program execution gets completed the temporary file also gets deleted.
Move_uploaded_file(file,newloc) : this function moves an uploaded file to a new location.
Program to display entire file of your application folder?
    

<p style="font-family: verdana;font-size: 20px; line-height: 2">
<?php
$handle = opendir(".");
while($f=readdir($handle))
{
    //echo $f."<br>";
    if(is_file($f))
    {
        echo "<a href=".$f." target=_blank>".$f."</a><br>";
    }
}
?>
</p>   
OutPut:
program to read an image file content?
<?php
$fp = fopen("Photo0105.jpg","rb");
$str = fread($fp,filesize("Photo0105.jpg"));
header("content-type : image/jpeg");
echo $str;
?>
OutPut:
Image displayed

0 comments:

Post a Comment