title: How to upload file to AWS s3 in Lumen
body: <p>I am writing an application in Lumen, to provide APIs to the frontend framework. I am struggling with file upload to S3. 
  Steps I followed.</p>
  
  <ul>
  <li>Configured .env file with </li>
  </ul>
  
  <blockquote>
    <p>AWS_ACCESS_KEY_ID=AKXXXXXXXXXXXXXXXXXX
        AWS_SECRET_ACCESS_KEY=nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
        AWS_DEFAULT_REGION=me-south-1
        AWS_BUCKET=your_bucket_name
        AWS_URL=<a href="https://apigateway.me-south-1.amazonaws.com" rel="nofollow noreferrer">https://apigateway.me-south-1.amazonaws.com</a></p>
  </blockquote>
  
  <ul>
  <li><p>Using composer installed AWS SDK for Laravel </p>
  
  <p>composer require aws/aws-sdk-php-laravel:~3.0</p></li>
  <li><p>Now wrote the function like this</p>
  
  <pre><code>public function upload(Request $request)
  {
      $image = $request-&gt;file('image');
      $imageFileName = time() . '.' . $image-&gt;getClientOriginalExtension();
      $s3 = Storage::disk('s3');
      $filePath = '/venue/' . $imageFileName;
      $s3-&gt;put($filePath, file_get_contents($image));
      return response()-&gt;json(['status' =&gt; true, 'data' =&gt; $imageFileName], Response::HTTP_OK);
  }
  </code></pre></li>
  </ul>
  
  <p>It would be really great if someone can share an article or full tutorial on how to do this.</p>