Error executing "ListObjects" on "https://s3.your-region.amazonaws.com/your-bucket?prefix=abc%2F1468895496.jpg%2F&max-keys=1&encoding-type=url"; AWS HTTP error: cURL error 6: Could not resolve host: s3.your-region.amazonaws.com (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
<?php
namespace App\Http\Controllers;
use Illuminate\Contracts\Filesystem\Filesystem;
use App\Product;
use Illuminate\Http\Request;
class ProductController extends Controller
{
...
public function store(Request $request)
{
$image = $request->file('file');
$imageFileName = time() . '.' . $image->getClientOriginalExtension();
$s3 = \Storage::disk('s3');
$filePath = '/abc/' . $imageFileName;
$s3->put($filePath, file_get_contents($image), 'public');
return redirect()->action('ProductController@index');
}
I think you havent set the config in config/filesystems.php
because the your-region
, your-bucket
etc is the default value.
Change at this section and make sure the key, secret, region and bucket are filled up.
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'visibility' => 'public',
],
// s3 part is here
's3' => [
'driver' => 's3',
'key' => 'your-key',
'secret' => 'your-secret',
'region' => 'ap-southeast-1', // this is the region setting
'bucket' => 'your-bucket',
],
],
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With