On Sun, Mar 3, 2013 at 5:07 AM, Tyler Romeo tylerromeo@gmail.com wrote:
Hey,
So I'm working on making an S3 file backend for E:AWS, but I've run into an issue. FileBackend::doCreateInternal expects an array of options, one of those options should be an array of headers, e.g., Content-Type. Amazon S3 needs the Content-Type header, otherwise it just shows up as a file download. From looking at the upload workflow, it seems the headers are being determined by MediaHandler::getStreamHeaders when it's called from LocalFile::upload().
However, upon inspecting the code for MediaHandler::getStreamHeaders.....the entire function body is "return array()". So, um, was this just never implemented, or am I missing something.
That's a default implementation, as most handler don't need to add any headers. If you look in some of the file type handler extensions like OggHandler or TimedMediaHandler, you'll see them overriding this function to add things like file duration info.
For a File::upload() implementation I think you'll want to grab $this->getMimeType() and send it as necessary.
-- brion