我正在尝试按照文档和源文件中提供的示例将文件上载到S3。不幸的是,我尝试上传时收到以下错误:收到“无效的政策文件或请求标题!”
[Fine Uploader 5.3.2]无效的策略文档或请求标头!
[精细上传5.3.2]政策签名失败。无效的政策文件 或请求标题!
我在这里发现了一些类似的错误,但这些解决方案并没有帮助我。
这里是我的jQuery:
<script>
$('#fine-uploader').fineUploaderS3({
request: {
endpoint: "http://mybucket.s3.amazonaws.com",
accessKey: "changeme"
},
signature: {
endpoint: "endpoint.php"
},
uploadSuccess: {
endpoint: "success.html"
},
template: 'qq-template'
});
</script>
(请注意,我改变了按键/桶名称为安全着想。)
我用您的端点cors.php为模型,并已列入
require 'assets/aws/aws-autoloader.php';
use Aws\S3\S3Client;
// These assume you have the associated AWS keys stored in
// the associated system environment variables
$clientPrivateKey = $_ENV['changeme'];
// These two keys are only needed if the delete file feature is enabled
// or if you are, for example, confirming the file size in a successEndpoint
// handler via S3's SDK, as we are doing in this example.
$serverPublicKey = $_ENV['AWS_SERVER_PUBLIC_KEY'];
$serverPrivateKey = $_ENV['AWS_SERVER_PRIVATE_KEY'];
// The following variables are used when validating the policy document
// sent by the uploader.
$expectedBucketName = $_ENV['mybucket'];
// $expectedMaxSize is the value you set the sizeLimit property of the
// validation option. We assume it is `null` here. If you are performing
// validation, then change this to match the integer value you specified
// otherwise your policy document will be invalid.
// http://docs.fineuploader.com/branch/develop/api/options.html#validation-option
$expectedMaxSize = (isset($_ENV['S3_MAX_FILE_SIZE']) ? $_ENV['S3_MAX_FILE_SIZE'] : null);
我也改变此:
我改性这里的部分210的POST似乎工作:
POST http://test.mydomain.com/somepath/endpoint.php 200 OK 318ms
...但是这就是成功结束。
我认为问题的一部分是,我不知道该怎么对“clientPrivateKey”进入。那是我用IAM建立的“秘密访问密钥”吗?
而且我在那里我得到的serverPublicKey和serverPrivateKey肯定不清楚。我在哪里生成S3上的密钥对?我梳理了文档,也许我错过了它。
非常感谢您的协助!
谢谢你的回应。我按照你的指示切换到了endpoint.php示例,像以前一样填入了环境变量......但是我仍然得到相同的确切错误:“无效的策略文档或请求标头!”和“策略签名失败。无效的策略文档或请求标头!”我可以提供哪些额外信息? – mrbranden
前几天(11月6日),我购买了该产品的许可证以及技术支持凭单,以便解决此问题。我还没有听到任何回复,甚至没有收到票证。我需要做什么才能让我的票获得注意?非常感谢你。 – mrbranden
@mrbranden您的邮件被我们的垃圾邮件过滤器捕获。现在回应它。 –