ops eccolo
codice:
<?
//user defined variables
$abpath = "/home/zachwhit/public_html/demo/imgz11"; //Absolute path to where images are uploaded. No trailing slash
$sizelim = "no"; //Do you want size limit, yes or no
$size = "2500000"; //What do you want size limited to be if there is one
//all image types to upload
$cert1 = "image/pjpeg"; //Jpeg type 1
$cert2 = "image/jpeg"; //Jpeg type 2
$cert3 = "image/gif"; //Gif type
$cert4 = "image/ief"; //Ief type
$cert5 = "image/png"; //Png type
$cert6 = "image/tiff"; //Tiff type
$cert7 = "image/bmp"; //Bmp Type
$cert8 = "image/vnd.wap.wbmp"; //Wbmp type
$cert9 = "image/x-cmu-raster"; //Ras type
$cert10 = "image/x-x-portable-anymap"; //Pnm type
$cert11 = "image/x-portable-bitmap"; //Pbm type
$cert12 = "image/x-portable-graymap"; //Pgm type
$cert13 = "image/x-portable-pixmap"; //Ppm type
$cert14 = "image/x-rgb"; //Rgb type
$cert15 = "image/x-xbitmap"; //Xbm type
$cert16 = "image/x-xpixmap"; //Xpm type
$cert17 = "image/x-xwindowdump"; //Xwd type
$log = "";
//begin upload 1
//checks if file exists
if ($imgz1_name == "") {
$log .= "No file selected for upload 1
";
}
if ($imgz1_name != "") {
//checks if file exists
if (file_exists("$abpath/$imgz1_name")) {
$log .= "File 1 already existed
";
} else {
//checks if files to big
if ($sizelim == "yes") {
if ($imgz1_size > $size) {
$log .= "File 1 was too big
";
}
}
//Checks if file is an image
if (($imgz1_type == $cert1) or ($imgz1_type == $cert2) or ($imgz1_type == $cert3) or ($imgz1_type == $cert4) or ($imgz1_type == $cert5) or ($imgz1_type == $cert6) or ($imgz1_type == $cert7) or ($imgz1_type == $cert8) or ($imgz1_type == $cert9) or ($imgz1_type == $cert10) or ($imgz1_type == $cert11) or ($imgz1_type == $cert12) or ($imgz1_type == $cert13) or ($imgz1_type == $cert14) or ($imgz1_type == $cert15) or ($imgz1_type == $cert16) or ($imgz1_type == $cert17)) {
@copy($imgz1, "$abpath/$imgz1_name") or $log .= "Couldn't copy image 1 to server
";
if (file_exists("$abpath/$imgz1_name")) {
$log .= "File 1 was uploaded
";
}
} else {
$log .= "File 1 is not an image
";
}
}
}