Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用php在没有访问权限的情况下上传到Amazon S3&;密钥_Php_Amazon S3 - Fatal编程技术网

使用php在没有访问权限的情况下上传到Amazon S3&;密钥

使用php在没有访问权限的情况下上传到Amazon S3&;密钥,php,amazon-s3,Php,Amazon S3,使用PHP,我想上传一些文件到AmazonS3公共存储桶。但我不想在代码中使用访问密钥和密钥。因为当我搜索发现使用关键字“null”可以解决这个问题。在PHP中,我们使用“”作为null,但运气不好。下面是我的代码 <?php if (!class_exists('s3'))require_once('s3.php'); //AWS access info if (!defined('awsAccessKey')) define('awsAccessKey', 'null'); if (

使用PHP,我想上传一些文件到AmazonS3公共存储桶。但我不想在代码中使用访问密钥和密钥。因为当我搜索发现使用关键字“null”可以解决这个问题。在PHP中,我们使用“”作为null,但运气不好。下面是我的代码

<?php

if (!class_exists('s3'))require_once('s3.php');
//AWS access info
if (!defined('awsAccessKey')) define('awsAccessKey', 'null');
if (!defined('awsSecretKey')) define('awsSecretKey', 'null');
//instantiate the class
$s3 = new S3(awsAccessKey, awsSecretKey);
$s3->putBucket("bucket name", S3::ACL_PUBLIC_READ_WRITE);

//move the file
if ($s3->putObjectFile("your file name in the server with path", "bucket name", "fine name in s3 server",S3::ACL_PUBLIC_READ_WRITE)){

//s3 upload success

}

请参见此处。。。然后像
news3一样尝试(null,null),当前必须将null作为字符串。抱歉,出现此错误[AccessDenied]此操作禁止匿名访问