Загрузите файлы в laravel, используя Response::downloadPhp

Кемеровские программисты php общаются здесь
Ответить
Гость
 Загрузите файлы в laravel, используя Response::download

Сообщение Гость »


In the Laravel application, I'm trying to achieve a button inside the view that can allow users to download files without navigating to any other view or route Now I have two issues: (1) below function throwing

The file "/public/download/info.pdf" does not exist (2) The Download button should not navigate the user anywhere and rather just download files on the same view, My current settings, route a view to '/download'

Here is what I am trying to achieve:

Button:

Download Brochure Route :

Route::get('/download', 'HomeController@getDownload'); Controller :
public function getDownload(){ //PDF file is stored under project/public/download/info.pdf $file="./download/info.pdf"; return Response::download($file); }

Источник: https://stackoverflow.com/questions/204 ... sedownload
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Php»