All pastes #567244 Raw Edit

Mine

public php v1 · immutable
·published 2007-06-14 21:54 UTC
rendered paste body
<?php// specify the directory where the uploaded file should end up$path = 'upload/' ;// specify the filetypes allowed$allowed = array('image/gif','image/pjpeg','image/jpeg','image/png','audio/mp3','audio/wma');// specify the max filesize in bytes$max_size = 2000000;if(isset($_FILES['userfile'])){  if(is_uploaded_file($_FILES['userfile']['tmp_name']))  {   if($_FILES['userfile']['size'] < $max_size)   {    if(in_array($_FILES['userfile']['type'],$allowed))    {     if(!file_exists($path . $_FILES['userfile']['name']))     {      if(@rename($_FILES['userfile']['tmp_name'],$path.$_FILES['userfile']['name']))      {       $html_output = 'Upload sucessful!<br>';       $html_output .= 'File Name: '.$_FILES['userfile']['name'].'<br>';       $html_output .= 'File Size: '.$_FILES['userfile']['size'].' bytes<br>';       $html_output .= 'File Type: '.$_FILES['userfile']['type'].'<br>';       $html_output .= 'File Path: '.$_FILES['userfile']['name'].'<br>';       $image = $_FILES['userfile']['name'] ;      }else{       $html_output = 'Upload failed!<br>';       if(!is_writeable($path))       {        $html_output = 'The Directory "'.$path.'" must be writeable!<br>';       }else{        $html_output = 'an unknown error ocurred.<br>';       }      }     }else{      $html_output = 'The file already exists<br>';     }    }else{     $html_output = 'Wrong file type<br>';    }   }else{    $html_output = 'The file is too big<br>';   }  }}else{  $html_output = '<form method="post" enctype="multipart/form-data" action="'.$_SERVER['PHP_SELF'].'">';  $html_output .= '<input type="file" name="userfile">';  $html_output .= '<input type="submit" value="upload">';  $html_output .= '</form>';}echo '<html><head><title>Uploader</title></head><body>';echo $html_output;echo '</body></html>';?>