All pastes #545100 Raw Edit

Mine

public php v1 · immutable
·published 2007-06-06 18:19 UTC
rendered paste body
<?php $maxsize=28480; //set the max upload size in bytesif (!$HTTP_POST_VARS['submit']) {  //print_r($HTTP_POST_FILES);  $error = " ";//this will cause the rest of the processing to be skipped//and the upload form displaysif ($is_uploaded_file($HTTP_POST_FILES['upload_file']['tmp_name']) AND!isset($error)) {  $error = "<b>You must upload a file!</b><br><br>";  unlink($HTTP_POST_FILES['upload_file']['tmp_name']);}if ($HTTP_POST_FILES['upload_file']['size'] > $maxsize AND !isset($error)) {  $error = "<b>Error, file must be less then $maxsize bytes</b><br><br>";  unlink($HTTP_POST_FILES['upload_file']['tmp_name']);}if($HTTP_POST_FILES['upload_file']['type'] != "image/gif" AND$HTTP_POST_FILES['upload_file']['type'] != "image/pjpeg" AND$HTTP_POST_FILES['upload_file']['type'] != "image/jpeg" AND !isset($error)) {$error = "<b>You many only upload .gif or .jpeg files.</b><br><br>";  unlink($HTTP_POST_FILES['upload_file']['tmp_name']);}if (!isset($error)) {copy($HTTP_POST_FILES['upload_file']['tmp_name'],"uploads/".$HTTP_POST_FILES['upload_file']['name']);  unlink($HTTP_POST_FILES['upload_file']['tmp_name']);  print "Thank you for your upload.";  exit;}else{  echo ("$error");}?><html><head><title>Upload Your Funny Photos/Movies/Songs Here</title></head><body><form action="<?=$PHP_SELF?>" method="post" enctype="multipart/form-data">Choose a file to upload:<br><input type="file" name="upload_file" size="80"><br><input type="submit" name="usubmit" value="submit"></form></body></html>