Problem downloading audio .wav Laravel 5.2 [closed]

0

When it comes down to the .mp3 audio it works normally, but when it's a .wav audio, it's low, but when I hear a runtime error. If I go to the directory where the .wav audio is, I can hear it normally, the problem is really only when it is low. Downloading code

$filename = $arquivo;
$path = storage_path('app/ligacoes_snep/'.$filename);

return Response::make(file_get_contents($path), 200, [
                'Content-Type' => 'audio/wav',
                'Content-Disposition' => 'inline; filename="'.$filename.'"']);

In Content-Type already tried audio / vnd.wave, audio / wav, audio / wave, audio / x-wav.

    
asked by anonymous 17.11.2017 / 19:30

2 answers

0

Solved. My problem was not with the file extension, but rather a code that I was running before the download

SSH::into('intranet')->run("rm -/var/www/html/intranet/storage/app/ligacoes_snep/", function($line){
          echo $line;
});

Thanks for everyone's attention.

    
20.11.2017 / 12:08
0

According to Laravel documentation (documentation of 5.5, but compatible with 5.2)

The best you can use:

  

return response () - > download ($ pathToFile);

     

return response () -> download ($ pathToFile, $ name, $ headers);

     

return response () - > download ($ pathToFile) -> deleteFileAfterSend (true);

Or the

  

return response () -> file ($ pathToFile);

    
18.11.2017 / 17:23