I’m trying to use sendFile to open dwfx file (Autodesk Design Review file) but the file I get is corrupted.

If I compared with Winmerge the original file on the server and the received with the browser, there is an CRLF on the beginning of the file and 2 extra #0 #0 at the end.

 I'm using the function in a action of a controller like this :

   if (file_exists($filename)) {

      return \Yii::$app->response->sendFile($filename, $shortname.'.'.$ext, ['mimeType' => "Content-Type: ".$mimetype]);


I have also tried :


I tried using <> Mimetype  but the result is the same

     $mimetype = "Content-type: application/x-Autodesk-DWF";


     $mimeType = 'application/octet-stream';

Any help welcome.

you may use this:

\Yii::$app->response->sendContentAsFile($content, $filename, $mimeType);

how to download file .if i uploded to fronend/web/upload.

any suggestion.