Displaying image in foreach blade.php

So, I am trying to display image, here is how i create my data

public function create_supplier(Supplier $request)
        $validatedData = $request->validated();

        $extension = $request->file('logoimg')->getClientOriginalExtension();
        $filename = $request->supplier_name . '.' . $extension;
        $request->file('logoimg')->storeAs('/storage/supplier_logo/', $filename);

        $supplier = ModelsSupplier::create([
            'supplier_name' => $request->supplier_name,
            'address' => $request->address,
            'email' => $request->email,
            'phone_number' => $request->phone_number,
            'logoimg' => $request->logoimg

        return response()->json(['message' => 'Supplier successfully added', 'supplier' => $supplier]);

Now, I want to display the logo img in blade.php

                @foreach($suppliers as $supplier)
                    <td><img src="{{ asset('storage/supplier_logo/' . $supplier->logoimg) }}" alt="test"></td>

it has successfully display the supplier_name, address, etc. but it shows the alt text that is "test". the file has also been successfully added to my storage/supplier_logo.

however, this is the value in my phpmyadmin, C:\xampp\tmp\php15CC.tmp

please do help, thank you!


  • you need to save image url that saved on disk into your database , not the $request->logoimg .

    storeAs() return the file path

    $filepath = $request->file('logoimg')->storeAs('/storage/supplier_logo/', $filename);
    $supplier = ModelsSupplier::create([
        'supplier_name' => $request->supplier_name,
        'address' => $request->address,
        'email' => $request->email,
        'phone_number' => $request->phone_number,
        'logoimg' => $filepath

    i dont test the code , maybe you need some debug