Downloaded croup File in cake php3.6


#1

$response = $this->response->withFile( $file['path'], ['download' => true, 'name' => 'foo'] ); return $response;
dowloading a file but file always crrupted Why so?


#2

Whats the file type? Sometimes you need send the header to browser with the type of the file to work corretly.
Ex:

$this->RequestHandler->respondAs('pdf');
$this->response->withHeader('Content-type', 'application/pdf');