I already replied to this on stackoverflow, but the short version is that, unfortunately, Last-Modified is not a value that AWS allows to be modified, it will automatically be updated when files are created or updated instead.
On Thu, Jul 30, 2015 at 7:16 AM, Gavriel Fleischer <[email protected]> wrote: > Hi, > > I am trying to copy a file into the cloud (both to SoftLayer and to AWS) > and I need to preserve the "Last-Modified" header, so when I retrieve it > back from the clouds I would see the last_modified time I provided. > I can't figure out how to do it. I tried it in these ways: > > > dir = s3.directories.get("mybucket") > last_modified = Time.at(1437600000) > > dir.files.create(key: "file2.txt", body: "content string", last_modified: > last_modified.httpdate) > > dir.files.create(key: "file2.txt", body: "content string", last_modified: > last_modified) > > dir.files.create(key: "file2.txt", body: "content string", 'Last-Modified' > => last_modified) > > dir.files.create(key: "file2.txt", body: "content string", 'Last-Modified' > => last_modified.httpdate) > > path = "/tmp/to_upload.txt" > File.open(path, "w+") { |file| > file.write("content string") > } > FileUtils.touch(path, mtime: last_modified) > dir.files.create(key: key, body: open(path)) > > -- > You received this message because you are subscribed to the Google Groups > "ruby-fog" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "ruby-fog" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
