$uploadOk = 0; } if ($error == "" && $upload->checkImageExist($target_file)) { $error = "Image with same name exist"; $uploadOk = 0; } if ($error == "" && $uploadOk) { $moved_ok = move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file); if ($moved_ok) { $thumb = new Imagick(); $thumb->readImage($target_file); $thumb->resizeImage(420, 420, imagick::FILTER_LANCZOS, 0.9, false); $save_file = str_replace("../uploads/", "", $target_file); $thumb->writeImage($target_file); $error = "The file has been uploaded."; $upload->addImage($_SESSION["user"], $save_file); } } } ?> <div class="container"> <div class="panel panel-default"> <div class="panel-heading"><strong>Upload Files</strong></div> <div class="panel-body"> <?php if (isset($_FILES["fileToUpload"]) && $uploadOk) { echo '<div class="alert alert-success" role="alert"> <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> <span class="sr-only">Error:</span> ' . $error . '