All pastes #674994 Raw Edit

Mine

public php v1 · immutable
#674994 ·published 2007-08-29 18:48 UTC
rendered paste body
<?phpif($_POST['f']) {srand((double)microtime()*1000000); $r = rand(0,100000); $target = "../uploads";$target = $target.$r;$ok=1;$ext = substr($_FILES['uploaded']['name'],-4);//This is our size conditionif ($uploaded_size > 350000){echo "Error: Your file is too large.<br />";$ok=0;}//This is our limit file type conditionif ($ext!=".jpg"&&$ext!=".gif"&&$ext!=".png"&&$ext!=".gif"&&$ext!="jpeg"&&$ext!=".psd"){echo "Error: This file type is not allowed.<br />";$ok=0;}//Here we check that $ok was not set to 0 by an errorif ($ok==0){Echo "Sorry, but your file was not uploaded.";}//If everything is ok we try to upload itelse{if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)){echo "The file ".basename($_FILES['uploaded']['name']). " has been uploaded here: http://seekond.com/uploads/".$r;}else{echo "Sorry, there was a problem uploading your file.";}}}else {?><form enctype="multipart/form-data" action="upload.php" method="POST">Please choose a file: <input name="uploaded" type="file" /><br /><input type="submit" value="Upload" name="f" /></form><?php}?>