Reputation: 642
I'm using com.amazonaws.services.s3.AmazonS3 to upload files from my server to amazon's one. Everything is working perfectly but I'm going crazy because of an issue:
I am uploading several files and folders (mostly images, js and css files). The files get uploaded nicely however I have one particular css file (jquery-mobile-1.0.1.css) that gets uploaded however when an html relies on that file, the css is not loaded, until I go and manually upload that one file again and make it public. I literally tried everything (changed file name, location, encoding) but nothing seems to be working. Does anyone have an idea what can cause the problem? The files are uploaded dynamically, so the way that the particular css file gets uploaded does not differ from other css files.
Any help is appreciated.
Upvotes: 1
Views: 386
Reputation: 26919
The mime type (HTTP content type header) on the files you uploaded is incorrect. S3 does not always set them correctly. Both JS files and CSS files are set to text/html - should be text/css
and text/javascript
.
You need to set them appropriately on the upload API call. Some upload libraries will do this for you, yours clearly isn't.
http://orensol.com/2009/07/14/google-chrome-2-css-content-type-and-amazon-s3/
Upvotes: 3