2016-07-19 5 views
2

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)Laravel AWS S3 Загрузить фото ошибка (область?)

<?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('[email protected]'); 
    } 
+0

Связанный: http://stackoverflow.com/questions/34588066/laravel-5-1-seems-not-to-be-adding-config-values-to-s3-upload/34599133 – pah

ответ

2

Я думаю, что у вас нету установить конфиг в config/filesystems.php, потому что your-region, your-bucket и т.д. значение по умолчанию.

Изменить этот раздел и убедиться, что ключ, секрет, область и ковш заполнены.

'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', 
    ], 

], 
Смежные вопросы