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
My Controller Function that throws this error when using any of these middleware
/**
* Download torrent
*
* @access public
* @param string $slug
* @param int $id
* @return file
*/
public function download($slug, $id)
{
// Find the torrent in the database
$torrent = Torrent::withAnyStatus()->findOrFail($id);
// Grab Current User
$user = Auth::user();
// User's ratio is too low
if ($user->getRatio() < config('other.ratio')) {
return Redirect::route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])->with(Toastr::warning('Your Ratio Is To Low To Download!!!', 'Error!', ['options']));
}
// User's download rights are revoked
if ($user->can_download == 0) {
return Redirect::route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])->with(Toastr::warning('Your Download Rights Have Been Revoked!!!', 'Error!', ['options']));
}
// Torrent Status Is Rejected
if ($torrent->isRejected()) {
return Redirect::route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])->with(Toastr::warning('This Torrent Has Been Rejected By Staff', 'Error!', ['options']));
}
// 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));
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);
}</code></pre>
The text was updated successfully, but these errors were encountered:
LogicException: The content cannot be set on a BinaryFileResponse instance. in /var/www/html/vendor/symfony/http-foundation/BinaryFileResponse.php:323
Stack -- | --
My Controller Function that throws this error when using any of these middleware
The text was updated successfully, but these errors were encountered: