def __read_file(self, line, length): """ Reads the file that is uploaded into a temp directory. :param line: First line of the file :param length: Length of the content """ self.__tmp = Settings.Settings.WORKING_DIR + '/tmp/' + str(time.time()) with open(self.__tmp, 'wb') as o: o.write(line) max_int = 100000000 loop = length / max_int m = length % max_int for i in range(0, loop): with open(self.__tmp, 'ab') as o: o.write(self.rfile.read(max_int)) with open(self.__tmp, 'ab') as o: o.write(self.rfile.read(m)) Event.add_event(obj=File(self.__tmp), method='delete', interval=4, onetime=True, key=self.__tmp, start=True)