I want to override the Content-Type to "application/octet-stream" when sending any file to s3 with fine uploader.
I am uploading video files and when retrieving them I never want them to opened by the browser I always want the downloaded.
I tried overriding it in the signature signing but then the upload fails the signature test. Can I get fine uploader to tell s3 it to save it as a "application/octet-stream"?
Or is there a way when generating a pre-signed url with the AWS SDK to tell it to always send as "application/octet-stream"? I thought this might do that, but in chrome at least it tries to play a video in the browser.
var headerOverrides = new ResponseHeaderOverrides { ContentType = "application/octet-stream" };
var urlRequest = new GetPreSignedUrlRequest
{
BucketName = _bucketName,
Key = key,
Expires = DateTime.Now.AddMinutes(120),
ResponseHeaderOverrides = headerOverrides,
Protocol = Protocol.HTTPS,
Verb = HttpVerb.GET
};
Setting the Content-Type
header to some generic value is not the proper way to solve your problem. Instead, you'll need to set the appropriate Content-Disposition
header. Currently, you'll need to make this adjustment on your object via the sever using the S3 API as part of handling Fine Uploader's upload success call. There is an open case to allow these types of headers to be associated with each object client-side.