diff --git a/Controller/LaguController.php b/Controller/LaguController.php index a803b858aa116966f70edbec8cf78361a7a1757e..8d1560e1ed1cdd743e9808a296da10fae4831306 100644 --- a/Controller/LaguController.php +++ b/Controller/LaguController.php @@ -270,11 +270,12 @@ class LaguController $target_dir = "audio/"; $file = $formData["file_lagu"]["name"]; - if( substr($formData["file_lagu"]['type'], 5) !== 'audio'){ + if( substr($formData["file_lagu"]['type'], 0, 5) !== "audio"){ return $res->view("Pages/AddSong", [ "auth" => $req->auth, "added" => false, "failed" => true, + "tipe" => substr($formData["file_lagu"]['type'], 5) ]); } @@ -296,11 +297,12 @@ class LaguController $target_dir = "image/"; $file = $formData["image_file"]["name"]; - if( substr($formData["image_file"]['type'], 5) !== 'image'){ + if( substr($formData["image_file"]['type'], 0, 5) !== "image"){ return $res->view("Pages/AddSong", [ "auth" => $req->auth, "added" => false, "failed" => true, + "tipe" => $formData["image_file"]['type'] ]); } @@ -319,6 +321,7 @@ class LaguController try { $transaction->insert( [ + "song_id" => rand(1,9223372036854775807), "title" => $title, "release_date" => $release_date, "duration" => $duration,