youtube-download-service/app/Http/Controllers/DownloadController.php

17 lines
376 B
PHP
Raw Normal View History

2024-06-17 12:44:56 +03:00
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class DownloadController extends Controller
{
public function download($file_name) {
2024-06-17 12:51:56 +03:00
$file_path = public_path('/'.'downloads/'.$file_name);
2024-06-18 09:45:09 +03:00
$headers = [
'Content-Type' => 'video/mp4',
];
return response()->download($file_path, $file_name, $headers);
2024-06-17 12:44:56 +03:00
}
}