Laravel 11 tutorial #38 Upload file | upload and display image

preview_player
Показать описание
This video teaches us how to upload and display images and files in Laravel 11 in Hindi. This video is made by Anil Sidhu in English.

Make a Small form to select file
Make a Controller for uploading file
Store file with auto-generated name
Store File with the provided name
Make upload file public
Display file after upload.
Interview Questions.

This Laravel series is made in 2024 and the current Laravel version is Laravel 11

Рекомендации по теме
Комментарии
Автор

1 question: if you provide <img alt="no file available"> in display.blade.php then why you explode it to split pub;ic, filename.png?without exploding public\filename.png will it not work?

rZERO_game
Автор

if we use alternative to explode methode then UploadController code looks like---

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class UploadController extends Controller
{
public function upload(Request $request)
{
// Store the file and get the path
$path =

// Get the file name using basename
$fileName = basename($path);

return view('display', ['path' => $fileName]);
}
} please replay

rZERO_game