Skip to content

Instantly share code, notes, and snippets.

@dwiash
dwiash / Upload.php
Created September 30, 2009 06:14
Simple file uploader (PHP)
<?php
if($_POST['submit'] == "submit"){
$uploaddir = $_POST['dir'];
$uploadfile = $uploaddir . basename($_FILES['file']['name']);
if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {
echo "<span style='color:#00f' >File was successfully uploaded.</span><hr />";
}
else
{
echo "<span style='color:#f00' >Upload failed!</span><hr />";