我正在嘗試按照文檔和源文件中提供的示例將文件上載到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您的郵件被我們的垃圾郵件過濾器捕獲。現在迴應它。 –