All pastes #265239 Raw Edit

gilesw

public php v1 · immutable
·published 2006-12-03 03:25 UTC
rendered paste body
<?php$target = "upload/";$target = $target . basename( $_FILES['uploaded']['name']) ;$ok=1;//This is our size conditionif ($uploaded_size > 350000){        echo "Your file is too large.</br>";        $ok=0;} //check if upload is an image (exif returns positive integer if it is)if(!exif_imagetype($_FILES['uploaded']['tmp_name'])){        echo "Your file isn't an image.</br>";}//Here we check that $ok was not set to 0 by an errorif ($ok==0){        echo "Sorry your file was not uploaded";} //If everything is ok we try to upload it        else {        if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) {                echo "The file ".                basename( $_FILES['uploadedfile']['name']). " has been uploaded";        }        else {                echo "Sorry, there was a problem uploading your file.";        }} ?>