pass file object instead of name