Using the Object storage service with PHP Laravel filesystems for S3.
The default laravel S3 configuration does not allow us to set the endpoint option which is required since we are not actually using AWS S3 but the NodeChef object storage service which is S3 compatible.
4. Simple example to upload the file in the request to the NodeChef S3 compatible bucket
use Illuminate\Http\Request;
use Illuminate\Contracts\Filesystem\Filesystem;
public function uploadFileToS3(Request $request)
{
$image = $request->file('image');
$imageFileName = time() . $image->getClientOriginalName();
$s3 = \Storage::disk('s3');
$s3->put($imageFileName, file_get_contents($image), 'public');
$publicURI = 'https://webPics.oss.nodechef.com/' . $imageFileName;
}
Note, in the above example we declare an unused variable $publicURI. This is only for demonstration purposes, to guide you on how to create
the public url of the files you upload.