I\'ve seen many questions here on this topic but nothing I\'ve come across has worked for me, so here I am posting another...
I\'m on Ruby on Rails trying to configu
Replace your add block with:
fd["Content-Type"] = data.files[0].type;
data.formData = fd;
data.submit();
The callback is correct, but data.formData already took the original version of fd. Just set it again with your modified fd and you should be good to go.
Update the controller method too so you're not doing it twice:
@s3_direct_post = S3_BUCKET.presigned_post(
key: "uploads/#{SecureRandom.uuid}/${filename}",
success_action_status: 201,
acl: :public_read).where(:content_type).starts_with("")
I believe the most current syntax for aws-sdk (2.9.6) is:
@s3_direct_post = S3_BUCKET.presigned_post(
key: "uploads/#{SecureRandom.uuid}/${filename}",
success_action_status: 201,
acl: 'public-read',
content_type_starts_with: '')
If anyone is looking for an updated answer to this question, I was able to solve this by: