Skip to content

Instantly share code, notes, and snippets.

@ozcan
Created September 14, 2015 12:34
Show Gist options
  • Select an option

  • Save ozcan/cd3901531e4c45e2680e to your computer and use it in GitHub Desktop.

Select an option

Save ozcan/cd3901531e4c45e2680e to your computer and use it in GitHub Desktop.
<?php
$base = '/var/www/upload';
$name = $_POST['name'];
$surname = $_POST['surname'];
$path = $base . '/' . $name;
if (!file_exists($path))
mkdir($path);
$path = $path . '/' . $surname;
if (!file_exists($path))
mkdir($path);
$path = $path . '/' . basename($_FILES['kulldosyasi']['name']);
if (move_uploaded_file($_FILES['kulldosyasi']['tmp_name'], $path))
{
echo "Dosya geçerli ve başarıyla yüklendi.\n";
} else {
echo "Olası dosya yükleme saldırısı!\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment