* If you're reading this, it's because I've given you the code.
* Do what you want with it. :)
******************************/
// Prepare the form
$form ="Select a file to upload:
";
$form .="
";
// Prepare the summary
$summary ="Upload Succeeded!
";
$summary .="";
$summary .="- Sent: $imagefile_name";
$summary .="
- Size: $imagefile_size bytes";
$summary .="
- Type: $imagefile_type";
$summary .="
- Location: http://void.printf.net/~cypher/images/$imagefile_name";
$summary .="
";
$summary .="Click here to view uploaded file";
// Set the time :)
$time = date("H:i dS F");
?>
Fu-el Slut File Uploader
Fu-el Slut File Uploader
Click here to view a full log
Logs have been cleared. It might be an idea to clear out all the uploaded files too. ;)");
}
// Print the form
echo ($form);
// Do the actual checking and uploading
if ($sent)
{
if ($_FILES['imagefile']['type'] == "image/pjpeg" OR "image/jpeg" OR "image/gif" OR "image/png")
{
echo "
";
copy ($_FILES['imagefile']['tmp_name'], "./images/".$_FILES['imagefile']['name']) or die ("Could not upload file, please contact the administrator.");
echo($summary);
// Log everything
$mklog = fopen("log.html","a");
fwrite($mklog,"Time: $time\t\tIP: $REMOTE_ADDR
");
fwrite($mklog,"File: $imagefile_name
");
fwrite($mklog,"Size: $imagefile_size bytes
");
// Close log
fclose($mklog);
}
else
{
echo "Please make sure the file you're uploading is a JPEG, GIF or PNG format image file.";
}
}
?>