def get_file_info(obj, fieldname, default=None):
<EOL>field = get_field(obj, fieldname)<EOL>fm = IFieldManager(field)<EOL>if fm.get_size(obj) == <NUM_LIT:0>:<EOL><INDENT>return None<EOL><DEDENT>out = {<EOL>"<STR_LIT>": fm.get_content_type(obj),<EOL>"<STR_LIT:filename>": fm.get_filename(obj),<EOL>"<STR_LIT>": fm.get_download_url(obj),<EOL>}<EOL>if req.get_filedata(False):<EOL><INDENT>data = fm.get_data(obj)<EOL>out["<STR_LIT:data>"] = data.encode("<STR_LIT>")<EOL><DEDENT>return out<EOL>
Extract file data from a file field

    :param obj: Content object
    :type obj: ATContentType/DexterityContentType
    :param fieldname: Schema name of the field
    :type fieldname: str/unicode
    :returns: File data mapping
    :rtype: dict