<?php // upload.php
  echo <<<_END
    <html><head><title>Formularz wysyłania plików w PHP</title><meta charset="utf-8"></head><body>
    <form method='post' action='upload.php' enctype='multipart/form-data'>
    Wybierz plik: <input type='file' name='filename'>
    <input type='submit' value='Wyślij'>
    </form>
_END;

  if ($_FILES)
  {
    $name = $_FILES['filename']['name'];
    move_uploaded_file($_FILES['filename']['tmp_name'], $name);
    echo "Wysłano obrazek '$name'<br><img src='$name'>";
  }

  echo "</body></html>";
?>
