Example #1
0
 $displayPic = $_FILES["display"]['name'];
 if ($displayPic != "") {
     $type = strstr($displayPic, '.');
     if ($type != ".gif" && $type != ".jpg" && $type != ".png") {
         echo 'invalid image type';
         exit;
     }
     $rand = rand(1000, 9999);
     $pics = date("YmdHis") . $rand . "display" . $type;
     if (!file_exists("public_html/img/projectImg/" . $edit_id)) {
         mkdir("public_html/img/projectImg/" . $edit_id, 0777, true);
     }
     $pic_path = "public_html/img/projectImg/" . $edit_id . "/" . $pics;
     move_uploaded_file($_FILES["display"]['tmp_name'], $pic_path);
     if ($photoMgr->getSpecificPhotoURL($edit_id, "display") !== '') {
         $photoMgr->updateSpecificPhoto($edit_id, "display", $pic_path);
     } else {
         $photoMgr->AddPhoto($edit_id, "display", $pic_path);
     }
 }
 //UPDATE HD AND THUMBNAIL
 $noOfPhoto = 20;
 for ($x = 1; $x <= $noOfPhoto; $x++) {
     $hdId = "hd" . strval($x) . "_input";
     $thumbnailId = "thumbnail" . strval($x) . "_input";
     $index = 0;
     $hdPicname = $_FILES[$hdId]['name'];
     if ($hdPicname != "") {
         $type = strstr($hdPicname, '.');
         if ($type != ".gif" && $type != ".jpg" && $type != ".png") {
             echo 'invalid image type';