request->session()->id().'.png'; $cakephpPath = str_replace('webroot/index.php', '', $_SERVER['SCRIPT_FILENAME']); $qrCodePath = $cakephpPath . 'webroot/img/' . $fileName; $this->request->session()->write('filename', $fileName); return QRcode::png($message, $qrCodePath); } }