Saturday, April 15, 2017

Laravel: getting stored filename

I am storing an uploaded file using the following code on my controller:

$stored_file = $request->file('image')->store(Config::get('filesystems.uploads.gallery_dir'));
Log::info($stored_file);

The $stored_file variable contains the full path of the file once saved, is there a function within Laravel to return just the generated name? (without the path)

Currently $stored_file returns uploads/gallery/wg7Aa4frj8PQkH89oIseMtlpFtruiJNsHTOoretn.jpeg
I would like to to return wg7Aa4frj8PQkH89oIseMtlpFtruiJNsHTOoretn.jpeg



via Imran

Advertisement