我的视频文件可以成功上传。但我无法在浏览器中播放。 当我要求它自动下载时。 我也使用了“内容类型:视频/ mp4”,但是当我请求时,它的内容类型是二进制/八位字节流
以下是我的python代码。
def get_bucket_sign_url(upload_path):
try:
presigned_post = s3_client.generate_presigned_post(
Bucket=settings.AWS_STORAGE_BUCKET_NAME,
Key=upload_path",
Fields={"acl": "public-read", "Content-Type": 'video/mp4'},
Conditions=[
{"acl": "public-read"},
{"Content-Type": 'video/mp4'},
{"success_action_status": "200"}
],
ExpiresIn=settings.S3_MAX_TIMEOUT # 3600
)
return presigned_post
except Exception:
return {}
以下是我的卷曲代码。
curl --location --request POST 'https://******.s3.amazonaws.com/' \
--form 'key=media/customer_videos/5556.mp4' \
--form 'file=@/home/user/Videos/ssm.mp4' \
--form 'acl=public-read' \
--form 'content-type=video/mp4' \
--form 'AWSAccessKeyId=*******' \
--form 'policy=******' \
--form 'signature=******'