def _upload_media(self,directory,files=None,resize_request=None):
<EOL>if not self._connectToFlickr():<EOL><INDENT>logger.error("<STR_LIT>")<EOL>return False<EOL><DEDENT>_tags=self._load_tags(directory)<EOL>_megapixels=self._load_megapixels(directory)<EOL>if not files:<EOL><INDENT>db=self._loadDB(directory)<EOL>files=list(db.keys())<EOL><DEDENT>if isinstance(files,str):<EOL><INDENT>files=[files]<EOL><DEDENT>files.sort()<EOL>for filename in files:<EOL><INDENT>status,replaced=self._upload_or_replace_flickr(directory,filename,_tags, _megapixels,resize_request)<EOL>if not status:<EOL><INDENT>return False<EOL><DEDENT>if not replaced:<EOL><INDENT>self._update_config_location(directory,filename)<EOL>self._update_config_sets(directory,filename)<EOL><DEDENT><DEDENT>return True<EOL>
Uploads media file to FLICKR, returns True if
        uploaded successfully, Will replace 
        if already uploaded, If megapixels > 0, will
        scale photos before upload
        If no filename given, will go through all files in DB