Skip to content

Instantly share code, notes, and snippets.

@pipethedev
Last active November 25, 2019 00:20
Show Gist options
  • Save pipethedev/08c6954a6cac495e9c7d7791969ab473 to your computer and use it in GitHub Desktop.
Save pipethedev/08c6954a6cac495e9c7d7791969ab473 to your computer and use it in GitHub Desktop.
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<title>PHP File Upload</title>
<!--Tailwind CDN---->
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
</head>
<body>
<?php
if (isset($_SESSION['message']) && $_SESSION['message'])
{
printf('<b>%s</b>', $_SESSION['message']);
unset($_SESSION['message']);
}
?>
<form method="POST" action="upload.php" enctype="multipart/form-data">
<div>
<div class="flex w-full h-screen items-center justify-center bg-grey-lighter">
<label class="w-64 flex flex-col items-center px-4 py-6 bg-white text-blue rounded-lg shadow-lg tracking-wide uppercase border border-blue cursor-pointer hover:bg-blue hover:text-white">
<svg class="w-8 h-8" fill="currentColor" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
<path d="M16.88 9.1A4 4 0 0 1 16 17H5a5 5 0 0 1-1-9.9V7a3 3 0 0 1 4.52-2.59A4.98 4.98 0 0 1 17 8c0 .38-.04.74-.12 1.1zM11 11h3l-4-4-4 4h3v3h2v-3z" />
</svg>
<span class="mt-2 text-base leading-normal">Select a file</span>
<input type='file' class="hidden" name="file" />
</label>
</div>
</div>
<input type="submit" name="upload" value="Upload" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded"/>
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment