Все еще не работат

This commit is contained in:
Dhaverd 2024-06-18 06:21:52 +03:00
parent b4ea9a0665
commit 04dbef81f6
3 changed files with 9 additions and 4 deletions

View File

@ -28,9 +28,12 @@ class YoutubeDownloadController extends Controller
return response(json_encode($response));
} else {
$videotitle = $video->getFile()->getFilename(); // Will return Phonebloks
$videotitle = str_replace('webp', 'mp4', $videotitle);
//$file_path = public_path('/'.'downloads/'.$videotitle);
//return response()->download($file_path);
// $video->getFile(); // \SplFileInfo instance of downloaded file
//$file_path = public_path('/downloads/'.$videotitle);
return redirect()->route('/download/'.$videotitle);
return redirect()->route('download', [$videotitle]);
//return response()->download($file_path);
}
}

View File

@ -20,11 +20,13 @@ export default {
name: "Main",
data: () => ({
url: ref(''),
fetching: ref(false)
}),
methods: {
startDownload(){
console.log(this.url);
this.fetching = true;
axios.get(`/download_api?videourl=${this.url}`).then((responce)=>{
this.fetching = false;
console.log(responce);
})
}

View File

@ -18,4 +18,4 @@ Route::get('/', function () {
});
Route::get('/download_api', 'App\Http\Controllers\YoutubeDownloadController@index');
Route::get('/download/{file}', 'App\Http\Controllers\DownloadController@download');
Route::get('/download/{file}', 'App\Http\Controllers\DownloadController@download')->name('download');