Answer the question
In order to leave comments, you need to log in
How to implement file download in laravel?
I get an error 500 (if I put in the controller , then everything outputs fine, but the download does not work).
controller:return '123';
public static function downdload(Request $request) {
$file = public_path(). $_POST['link'];
return Storage::download($file);
}
$('.this-block a').click(function() {
$.ajax({
url: '/ajax/download',
type: 'POST',
data: {
link: $(this).data('link'),
_token: "<?php echo csrf_token(); ?>"
},
success: function( data ) {
}
});
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question