Upload images: ( Do not upload any pornographic images, if someone does this will not be public )
$max_size) {
echo "The file is too big
\n";
exit;
}
if (($HTTP_POST_FILES['userfile']['type']=="image/gif") ||
($HTTP_POST_FILES['userfile']['type']=="image/jpeg") ||
($HTTP_POST_FILES['userfile']['type']=="image/jpg") ||
($HTTP_POST_FILES['userfile']['type']=="image/png")) {
// append random seed
$pos = strrpos($HTTP_POST_FILES['userfile']['name'],'.');
$nme = substr($HTTP_POST_FILES['userfile']['name'],0,$pos);
$ext = substr($HTTP_POST_FILES['userfile']['name'],$pos);
$sed = dechex(rand(256,4095));
$HTTP_POST_FILES['userfile']['name'] = $nme.$sed.$ext;
// if file still already exists, try a different seed
while (file_exists($path . $HTTP_POST_FILES['userfile']['name'])) {
$sed = dechex(rand(256,4095));
$HTTP_POST_FILES['userfile']['name'] = $nme.$sed.$ext;
}
$res = @copy($HTTP_POST_FILES['userfile']['tmp_name'], $path.$HTTP_POST_FILES['userfile']['name']);
if (!$res) {
echo "Upload failed! Check the upload folder's permissions.
\n"; exit;
} else {
echo "Upload sucessful!
\n";
}
echo "File Name: ".$HTTP_POST_FILES['userfile']['name']."
\n";
echo "File Size: ".$HTTP_POST_FILES['userfile']['size']." bytes
\n";
echo "File Type: ".$HTTP_POST_FILES['userfile']['type']."
\n";
$link_s = 'http://'.$_SERVER['HTTP_HOST'].'/'.$folder.'/'.$HTTP_POST_FILES['userfile']['name'];
$link_i = "[img]".$link_s."[/img]";
echo "
\n";
echo "URL:
\n";
echo "BBCode:
\n";
} else {
echo "Wrong file type!
\n";
exit;
}
}
?>