but when I modified it this way:
Code: Select all
<?
//user defined variables
$abpath = "/var/www/vhosts/mysite/subs/images/httpdocs/images"; //Absolute path to where images are uploaded.
$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
$log = "";
$random1 = rand(1, 99999999);
//begin upload 1
//checks if file exists
if ($_FILES['img1']['name'] == "") {
echo "No file selected for upload 1<br>";
}
if ($img1_name != "") {
//checks if file exists
if (file_exists("$abpath/$img1_name")) {
$log .= "File 1 already existed<br>";
} else {
//checks if files to big
if ($sizelim == "yes") {
if ($img1_size > $size) {
$log .= "File 1 was too big<br>";
}
}
//Checks if file is an image
if (($img1_type != $cert1) or ($img1_type == $cert2) or ($img1_type == $cert3)) {
if (($img1_type == $cert1) or ($img1_type == $cert2)) {
$_FILES['img1']['name'] = $random1 . ".jpeg";
}
if ($img1_type == $cert3) {
$img1_name = $random1 . ".gif";
}
@move_uploaded_file($_FILES['img1']['tmp_name'], $abpath . '/' . $_FILES['img1']['name']) ;
if (file_exists("$abpath/$img1_name")) {
$log .= "File 1 was uploaded<br>";
}
} else {
$log .= "File 1 is not an image<br>";
}
}
}
?>Is the problem in the $img1 again?I changed it to $_FILES['img1']['tmp_name'],but i get errors.