热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

AWSS3上传。根据策略无效:策略已过期-AWSS3upload.InvalidaccordingtoPolicy:Policyexpired

ImusingaDjangoserverhostedonEC2Singapore.ImalsousinganS3buckettosavefilesuploade

I'm using a Django server hosted on EC2 Singapore. I'm also using an S3 bucket to save files uploaded through the Django Admin panel. To upload files, I'm using django-s3direct.

我正在使用在新加坡EC2上托管的Django服务器。我还使用S3存储桶来保存通过Django Admin面板上传的文件。要上传文件,我正在使用django-s3direct。

When I upload files using my local machine on Eastern American time, it prevents me from uploading the files citing:

当我在美国东部时间使用本地计算机上传文件时,它阻止我上传文件,引用:

Invalid according to Policy: Policy expired.

I've tried the solutions from:
Fine Uploader getting "Policy expired" message sending to S3 for some and here: https://github.com/FineUploader/fine-uploader/issues/1387

我已经尝试过以下解决方案:Fine Uploader将“Policy expired”消息发送到S3以获取一些和此处:https://github.com/FineUploader/fine-uploader/issues/1387

When I check the uploaded time and the UTC time, there's no difference. How do I fix this error?

当我检查上传时间和UTC时间时,没有区别。我该如何解决这个错误?

EDIT: To be noted, the upload works perfectly on localhost but doesn't work on the server hosted on AWS EC2.

编辑:需要注意的是,上传在localhost上完美运行,但在AWS EC2上托管的服务器上不起作用。

1 个解决方案

#1


1  

Similar issues refer to an inaccurate clock. This should be the clock of the client not the server. I suggest writing code to check whether client's time in sync with a known and accurate time server. If the time is out of sync, a friendly message can be shown to the user to update the system's clock. If the time is in sync, you can then proceed with the upload.

类似的问题涉及不准确的时钟。这应该是客户端而不是服务器的时钟。我建议编写代码来检查客户端的时间是否与已知且准确的时间服务器同步。如果时间不同步,则可以向用户显示友好消息以更新系统的时钟。如果时间同步,则可以继续上传。


推荐阅读
author-avatar
挠挠扣扣笑嘻嘻
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有