Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

davy_yg's avatar
Level 27

Driver [] is not supported.

Hello,

When trying to upload an image to my ecommerce CMS I am getting this error message:

Driver [] is not supported.

...

    } else {
        throw new InvalidArgumentException("Driver [{$config['driver']}] is not supported.");
    }

What does it means?

Thanks in advance.

0 likes
8 replies
bobbybouwmann's avatar

Can you show your code? It looks like your variable is not being parsed correctly!

davy_yg's avatar
Level 27

The error appear whenever I try to upload new slides (image).

advertisements.blade.php

<form method="POST" action="{{ url('/cpages/advertisements/' . $type) }}" enctype="multipart/form-data">
 {{ csrf_field()}}

    <div class="form-group">
    <label for="ad_title">Ad Title:</label>
    <input type="text" class="form-control" id="" placeholder="" name="ad_title" required>
    </div>

    <div class="form-group">
    <label for="ad_caption">Ad Caption:</label>
    <input type="text" class="form-control" id="" placeholder="" name="ad_caption" required>
    </div>

    <div class="form-group">
    <label for="ad_url">Ad URL:</label>
    <input type="text" class="form-control" id="" placeholder="" name="ad_url" >
    </div>

    <div class="form-group">
    <label for="images">Slide Image:</label>
    <input type="file" class="form-control" name="images[]" accept="image/png,image/jpeg" required>
    </div>

<input type="submit" class="btn btn-success btn-lg pull-right" value="Add Slider" />

    <br /><br><br>

  </form>

AdvertisementController.php

class AdvertisementsController extends Controller
{
    public function __construct()
    {
        $this->middleware('staff');
    }

public function index($type)
    {
    if ($type != 'slider' && $type != 'index_featured' && $type != 'catalog_ad' && $type != 'banner_ads') {
        return back();
    }


    $ads = Advertisements::where('ad_type', $type)->latest()->get();

    return view('admin.advertisements.advertisements', compact('ads', 'type'));
    }

    public function store($type, Request $request)
    {
    $this->validate($request, [
      'ad_title' => 'required',
      'ad_caption' => 'nullable',
      'ad_url' => 'nullable|url',
      'images.0' => 'required|image|mimes:jpg,jpeg,png|max:10000'
    ]);

    if ($type == "slider") {
        $dir_location = 'slider_img';
        $dir = '/images/slides/';
    } elseif ($type == "index_featured") {
        $dir_location = 'index_featured';
        $dir = '/images/feature-content/';
    } elseif ($type == "catalog_ad") {
        $dir_location = 'catalog_ad';
        $dir = '/images/product-list/';
    } elseif ($type== "banner_ads") {
        $dir_location = 'banner-ads';
        $dir = '/images/banner-ads/';
    }

    $images = count(request('images'));

    for ($i=0; $i < $images ; $i++) {
        //Get the Original name
        $original_name = $request->file('images.'. $i)->getClientOriginalName();

        //Get the extension
        $extension = pathinfo($request->file('images.'. $i)->getClientOriginalName(), PATHINFO_EXTENSION);

        //Make URL-friendly slug
        $name_wo_extension = pathinfo($request->file('images.'. $i)->getClientOriginalName(), PATHINFO_FILENAME);
        $slug = str_slug($name_wo_extension, '-');

        //Check if the slug exist or not, if yes add '-copy' to filename
        $count = count(Advertisements::where('ad_img_url', $dir.$slug.'.'.$extension)->limit(1)->get());
        while ($count != 0) {
            $slug = $slug . '-copy';
            $count = count(Advertisements::where('ad_img_url', $dir.$slug.'.'.$extension)->limit(1)->get());
        }

        //Create the string for saving purpose
        $name = $slug . '.' . $extension;


        $request->file('images.'. $i)->storeAs(null, $name, $dir_location);


        /**This is to make thumbnail, not needed for Ads**/
        /*
        //Get the path for generate Pic with Intervention
        $img_path = $request->file('images.' . $i)->getRealPath();

        //Create the image
        $img = Image::make($img_path);

        //Resize
        $img->resize(404, 488);

        //Save it
        //Make sure the thumbnail folder exist
        $img->save(public_path($thumb_dir) . $name);
        */

        Advertisements::create([
          'ad_type' => $type,
          'ad_title' => request('ad_title'),
          'ad_caption' => request('ad_caption'),
          'ad_url' => request('ad_url'),
          'ad_img_url' => $dir. $name
        ]);
    }

    session()->flash('flash', 'Ads type:'.$type.' created');

    return redirect('/cpages/advertisements/'.$type);
}

    public function delete(Advertisements $advertisement)
    {
    Advertisements::where('ad_id', $advertisement->ad_id)->delete();
    Storage::disk('public-folder')->delete($advertisement->ad_img_url);

    session()->flash('flash', 'Ads Deleted');

    return redirect('/cpages/advertisements/'. $advertisement->ad_type);
    }
}

web.php

//Advertisements
Route::get('/cpages/advertisements/{type}', 'AdvertisementsController@index');
Route::post('/cpages/advertisements/{type}', 'AdvertisementsController@store');
KNietzsche's avatar
Level 17

I already got this error as well...

check that the filesystems.php contains your disk, for example

  'upload' => [
            'driver' => 'local',
            // 'root' => storage_path('app/public'),
            'root' => public_path() . '/projects/',
            // 'url' => env('APP_URL').'/storage',
            'visibility' => 'public',
        ],

then when you want to save your file $file->storeAs($project_id.'/upload', $fileName, 'upload'); 1st arg = path 2nd = filename 3rd = disk

the last argument 'upload' is the disk

1 like
davy_yg's avatar
Level 27

@bobbybouwmann : I finally change it to what you suggest:

//$request->file('images.'. $i)->storeAs(null, $name, $dir_location);
$request->file('images.'. $i)->storeAs($dir_location, $name);

It appears like uploading the image and receive a comment that it has been successful but the image is missing if I check it out. It's not in images/slides/

// It's missing only the url 
<img src="http://localhost/eliteshop/public/images/slides/slide3.jpg" width="200" height="200">

You know what?

This is a backend files that I copy and attached to a new front end. This backend works on other ecommerce site, but the error start to show up after I attached it to this new ecommerce frontend.

davy_yg's avatar
Level 27

I finally get it to work. I only forget to copy the config/filesystems.php

Please or to participate in this conversation.