Adding File Upload Support

<h1>Welcome to my Photo Album</h1>
<form action="<?echo $PHP_SELF?>" enctype="multipart/form-data" method=POST>
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
<input type=file name=file size=29>
<input type="submit" value=" Send File ">
</form>
<?
  
if($file) {
    
$formats = array('jpg','gif','png');
    
$dest "images/$file_name";
    if(
in_array(strtolower(substr($file_name,-3)),$formats)) {
      if(!
copy($file,$dest)) {
        echo 
"Unable to create $dest - check permissions<br>\n";
        exit;
      }
    }
  }
  
$fd opendir("images");
  while(
$entry readdir($fd)) {
    if(
eregi("\.(jpg|gif|png)$",$entry)) {
      echo 
"<a href=\"images/$entry\">";
      echo 
"<img src=\"images/$entry\" align=middle border=0 height=80 width=100>";
      echo 
"</a> $entry<br>\n";
    }
  }
  
closedir($fd);
?>

This is what it looks like: Photo Album Example