Anyone have a client that uploads images? I think I see a problem in mw_newMediaObject(). $data['bits'] has been escaped which will probably result in a screwed up file. Nothing in the $data array looks like it needs to be escaped; none of it goes to the DB. Here's a possible fix.