You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FatalThrowableError in SecureHeadersMiddleware.php line 26:
Call to undefined method Symfony\Component\HttpFoundation\BinaryFileResponse::header()
when I use this function:
/**
* Telecharge le torrent
*
* @access public
* @param string $slug Slug du torrent
* @param int $id Id du torrent
* @return file
*/
public function download($slug, $id)
{
// Find the torrent in the database
$torrent = Torrent::find($id);
if (Auth::check()) {
// Current user is the logged in user
$user = Auth::user();
// User's ratio is too low
if ($user->getRatio() < config('other.ratio') && config('other.freeleech') == false) {
return Redirect::route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])->with(Toastr::warning('Your Ratio Is To Low To Download!!!', 'Error!', ['options']));
}
} else {
$user = null;
}
// Define the filename for the download
$tmpFileName = $torrent->slug . '.torrent';
// The torrent file exist ?
if (!file_exists(getcwd() . '/files/torrents/' . $torrent->file_name)) {
return Redirect::route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])
->with(Toastr::warning('Torrent File Not Found! Please Report This Torrent!', 'Error!', ['options']));
} else {
// Delete the last torrent tmp file
if (file_exists(getcwd() . '/files/tmp/' . $tmpFileName)) {
unlink(getcwd() . '/files/tmp/' . $tmpFileName);
}
}
// Get the content of the torrent
$dict = Bencode::bdecode(file_get_contents(getcwd() . '/files/torrents/' . $torrent->file_name));
// Freeleech ?
if (config('other.freeleech') == true) {
// Set the announce key only
$dict['announce'] = route('announce');
} else {
if (Auth::check()) {
// Set the announce key and add the user passkey
$dict['announce'] = route('announce', ['passkey' => $user->passkey]);
// Remove Other announce url
unset($dict['announce-list']);
} else {
return redirect('/login');
}
}
$fileToDownload = Bencode::bencode($dict);
file_put_contents(getcwd() . '/files/tmp/' . $tmpFileName, $fileToDownload);
return Response::download(getcwd() . '/files/tmp/' . $tmpFileName);
}
The text was updated successfully, but these errors were encountered:
FatalThrowableError in SecureHeadersMiddleware.php line 26:
Call to undefined method Symfony\Component\HttpFoundation\BinaryFileResponse::header()
when I use this function:
The text was updated successfully, but these errors were encountered: