def from_file(self, filename):
mimetype = mimetypes.guess_type(filename)[<NUM_LIT:0>] or "<STR_LIT>"<EOL>headers = {<EOL>"<STR_LIT:Content-Type>": mimetype,<EOL>"<STR_LIT>": str(os.path.getsize(filename)),<EOL>}<EOL>file_data = self._pump.request(<EOL>"<STR_LIT>".format(self._pump.client.nickname),<EOL>method="<STR_LIT:POST>",<EOL>data=open(filename, "<STR_LIT:rb>").read(),<EOL>headers=headers,<EOL>)<EOL>data = {<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT:object>": file_data,<EOL>}<EOL>data.update(self.serialize())<EOL>if not self.content and not self.display_name and not self.license:<EOL><INDENT>self._post_activity(data)<EOL><DEDENT>else:<EOL><INDENT>self._post_activity(data, unserialize=False)<EOL>if self.content:<EOL><INDENT>file_data['<STR_LIT:content>'] = self.content<EOL><DEDENT>if self.display_name:<EOL><INDENT>file_data['<STR_LIT>'] = self.display_name<EOL><DEDENT>if self.license:<EOL><INDENT>file_data['<STR_LIT>'] = self.license<EOL><DEDENT>data = {<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT:object>": file_data,<EOL>}<EOL>self._post_activity(data)<EOL><DEDENT>return self<EOL>
Uploads a file from a filename on your system.

        :param filename: Path to file on your system.

        Example:
            >>> myimage.from_file('/path/to/dinner.png')