Quoted
Please note. I do not give support on version 1 any longer.
|
|
PHP Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
<?php $pic_path = $_SERVER['DOCUMENT_ROOT']."/12cropimage2/bilder/"; $max_fsize = 102400; // Maximum filesize if (isset($file)){ $source = $file; $source_name = $file_name; if(($source <> "none")&&($source <> "")){ //Checkes wether the uploaded file exists $dest = $pic_path.$source_name; if(move_uploaded_file($source,$dest)){ $transfer=$pic_path.$source_name; $size = GetImageSize($transfer); $fsize = filesize($transfer); $img_width=$size[0]; $img_height=$size[1]; $ext = substr($source_name, strrpos($source_name, ".")+1); //Strips the extension of the image switch (strtoupper($ext)){ case "JPEG": $format = "jpeg"; $aut="1"; break; case "JPG": $format = "jpeg"; $aut="1"; break; } if ($aut == "1") { //If the filetype is correct the authorisation is set to 1 if ($fsize > $max_fsize) { $foutje=$pic_path."$source_name"; @unlink($foutje); echo "The picture you sent had a filesize of $fsize bytes. This is too big! Mazimum filesyze is $max_fsize bytes."; exit; } $random_name = md5(uniqid(rand())); $session=$random_name."."; $new_file=$pic_path.$session.$format; $new_img = $session.$format; rename($transfer,$new_file); @unlink($source); } else { echo"Du hast nicht den richtigen Bildtyp ausgewählt. Es werden nur JPEG-Bilder akzeptiert."; @unlink($transfer); exit; } } else { echo "Irgendwas ist falsch gelaufen!\n"; // you need to write-enable the upload directory exit; } } else { echo "no valid file sent!"; exit; } if ($keep_logs == 1){ write_log($pic_log); } } else { echo "no valid file sent!"; exit; } ?> |
This post has been edited 3 times, last edit by "Surfer" (Dec 12th 2007, 5:06pm)
