Hi Paul, On Tue, Nov 3, 2009 at 4:02 PM, Paul Davis <paul.joseph.da...@gmail.com> wrote: > Carl, > >> However I noticed sometimes someone uploads an attachment but Firefox >> got the content-type wrong (done on the client side with my SUPER >> HACK). To correct this, I use Futon to edit the document JSON source >> and change the content_type and save the document. But my change to >> the content_type field does not get saved. > > I'm actually not entirely sure what would happen in this scenario. I > don't think we test it anywhere. Since futon grabs the _attachments > data as a stub, saving it back to the DB with the non-inline style > should just ignore any changes you make. And now that you mention it, > I don't think there's actually a way to change the content-type > without re-uploading the binary data. That definitely seems like > overlooked functionality, but not quite a bug. > >> // Mime-type SUPER HACK >> xhr.setRequestHeader("Content-Type", >> file.getAsDataURL().match(/data:([^;]*);/)[1]); >> xhr.sendAsBinary(file.getAsBinary()); > > I have never ever seen JavaScript that does such things. Is this > actually possible in a cross browser fashion or some FF extension? > > Paul Davis >
Yes that JavaScript relies on Mozilla Firefox 3 specific interfaces: https://developer.mozilla.org/en/NsIDOMFile https://developer.mozilla.org/en/nsIDOMFileList Thanks