In this tutorial, we will see ‘how to create file on Amazon s3 using php’.
Before using the following script, you must installed aws sdk php.
$s3 = \Aws\S3\S3Client::factory(array( 'key' => 'YOUR_ACCESS_KEY', 'secret' => 'YOUR_KEY_SECRET', )); $s3->registerStreamWrapper(); $stream = fopen("s3://YOUR_BUKCET/index.json", 'w', false, stream_context_create(array( 's3' => array( 'CacheControl' => 'no-cache', 'ACL' => 'public-read', ) ))); fwrite($stream, "content of index.json"); fclose($stream);