“File unduhan Laravel” Kode Jawaban

File unduhan Laravel

/** @param \Illuminate\Http\Request  $request
 * @return \Illuminate\Auth\Access\Response */
public function download(Request $request)
{
    $file = public_path(). "/images/test.jpg";
    $headers = ['Content-Type: image/jpeg'];
    if (file_exists($file)) {
        return \Response::download($file, 'plugin.jpg', $headers);
    } else {
        echo('File not found.');
    }
}
Literate Lentil

Unduh Laravel

composer global require "laravel/installer"
Fancy Fish

Unduh Laravel

composer global require "laravel/installer=~1.1"
Worrisome Wasp

File Unduh JavaScript

$('a#someID').attr({target: '_blank', 
                    href  : 'http://localhost/directory/file.pdf'});
JDog

Cara mengunduh file dengan laravel

<?php
 
namespace App\Http\Controllers;
 
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
 
class UserAvatarController extends Controller
{
    /**
     * Update the avatar for the user.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request)
    {
        $path = $request->file('avatar')->store('avatars');
 
        return $path;
    }
}
ObiTech Invents

Jawaban yang mirip dengan “File unduhan Laravel”

Pertanyaan yang mirip dengan “File unduhan Laravel”

Lebih banyak jawaban terkait untuk “File unduhan Laravel” di PHP

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya