コード例 #1
0
 public function submit()
 {
     $post = $_POST;
     $file = $_FILES['file_upload'];
     $request = new post($post, $file);
     $submission = $request->getPost();
     $database = new database();
     $query = $database->query();
     $image = new image($query, $submission);
     // upload image
     try {
         $upload = $image->upload();
     } catch (Exception $e) {
         echo 'Message: ' . $e->getMessage();
     }
     // insert image
     if (isset($upload) && $upload == 'success') {
         $images = new image($query, $submission);
         $image->insert();
     }
 }
コード例 #2
0
ファイル: operation.php プロジェクト: sherif700/ourWork
        $error[] = 'plz, upload image type';
    } else {
        if ($size1 > 42565433) {
            $error[] = 'plz, dun exceed the max limit of size';
        } else {
            move_uploaded_file($tmp_name1, 'images/' . $name1);
        }
    }
    if (!isset($_POST['option'])) {
        $error[] = 'plz , select a product';
    }
    if (empty($error)) {
        $img->image_path = $name;
        $img->image_path_1 = $name1;
        $img->product_id = $_POST['option'];
        $img->insert();
    }
    if (!empty($error)) {
        $_SESSION['errors'] = $error;
        header('location: image_insert.php');
    } else {
        header('location: image_control.php');
    }
} else {
    if (isset($_POST['sendupdate'])) {
        $img = new image($_POST['id']);
        $name = $_FILES['image']['name'];
        $size = $_FILES['image']['size'];
        $type = $_FILES['image']['type'];
        $tmp_name = $_FILES['image']['tmp_name'];
        $error = [];