return $response->withStatus(422)->withJson(["success" => false, "message" => "jobseekerId is not found on path.", "error" => 1]); } $jobseekerId = $args["jobseekerId"]; $getResult = CV::getOriginalFilePathByJobseekerId(["jobseeker_id" => $jobseekerId]); if ($getResult["success"]) { return $response->withStatus(200)->withHeader("Content-Length", $getResult["size"])->withHeader("Content-type", $getResult["mime"])->withHeader("Content-Disposition", 'attachment; filename="' . $getResult["name"] . '"')->withHeader("Content-Transfer-Encoding", "binary")->withHeader("Expires", "0")->withHeader("Cache-Control", "must-revalidate")->withHeader("Pragma", "public")->write($getResult["content"]); } else { return $response->withStatus(404)->withJson($getResult); } }); $app->get('/cv/download/original/byUploadId/{uploadId}', function ($request, $response, $args) { if (!isset($args["uploadId"])) { return $response->withStatus(422)->withJson(["success" => false, "message" => "uploadId is not found on path.", "error" => 1]); } $uploadId = $args["uploadId"]; $getResult = CV::getOriginalFilePathByUploadId($uploadId); if ($getResult["success"]) { return $response->withStatus(200)->withHeader("Content-Length", $getResult["size"])->withHeader("Content-type", $getResult["mime"])->withHeader("Content-Disposition", 'attachment; filename="' . $getResult["name"] . '"')->withHeader("Content-Transfer-Encoding", "binary")->withHeader("Expires", "0")->withHeader("Cache-Control", "must-revalidate")->withHeader("Pragma", "public")->write($getResult["content"]); } else { return $response->withStatus(404)->withJson($getResult); } }); // $app->post("/cv/jobseekerId", function ($request, $response, $args) { // $postParams = $request->getParsedBody(); // $jobseekerId; // $uploadId; // if (!isset($postParams["uploadId"])) { // return $response // ->withStatus(422) // ->withJson([ // "success" => false,