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