Search DXM Forum
You are correct, we need to add additional metadata to object that is being uploaded.
Content-Disposition: attachment;
filename="image.jpg"
Three options here -
1) Do it at the time of object creation
2) Use copy_object function to copy the object to itself with the new metadata.
3) Use the s3 console and manually manage addition of new metadata. (This can be insane if your files are being managed from the CMS, so practically, this is not an option)
I did not find any direct way where we can tweak s3 publising in CP's publishing packges, but you can employ any kind of a post-publish (PostPublishContext) event to do a copy_object function on the s3 object to itself - and add the new meta info then. You can try to employ some kind of an Asset Wrapper Template for the same.
Here's how you can attache the file on the asset wrapper template
//Attach file to the requested asset
AssetAttachRequest AttachReq = new AssetAttachRequest();
AttachReq.assetId = attachAssetId;
AttachReq.originalFilename = fileName;
AttachReq.bytes = File.ReadAllBytes(fileName);
//Renames the original filename
AttachReq.originalFilename = desiredUploadName;
AssetAttachResponse resp = accessAsset.Attach(AttachReq);
You will also need to create an intermediate web api or similar that you can consume inside the post publish event - as you will not be able to directly use the s3 sdk inside the template code.