Yesterday I transferred ~1500 files to our Amazon S3 bucket using Winscp. I have a problem when downloading PDF files, since they are returned without extension. The cause seems to be the wrong content type being present on the file in the S3 bucket. When I update the content type manually, the file is downloaded correctly. Since I have so many files manually changing the meta data is not an option.
The interesting part is that Excel files do have the correct content type. When looking into this difference, it seems like the machine I upload from does understand the Excel file format, since the file in Winscp is shown with an Excel icon. The PDF files have just a plain white icon.
Does anyone know how to solve the content type problem? Does it depend on the host computer understanding the file type so it can set the correct content type automatically?
question from:
https://stackoverflow.com/questions/65950173/amazon-s3-pdf-files-have-wrong-content-type-after-winscp-upload 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…