code: def download_local_file(filename, download_to_file):
      
      # Try to copy.
      try:
          path = urllib2.urlparse.urlsplit(urllib.unquote(filename))[2]
          if os.path.abspath(path) != path:
              msg = "%s is not a normalized path (would be %s)." \
                    % (path, os.path.normpath(path))
              raise InvenioFileCopyError(msg)
  
          allowed_path_list = current_app.config.get(
              'CFG_BIBUPLOAD_FFT_ALLOWED_LOCAL_PATHS', []
          )
          allowed_path_list.append(current_app.config['CFG_TMPSHAREDDIR'])
          for allowed_path in allowed_path_list:
              if path.startswith(allowed_path):
                  shutil.copy(path, download_to_file)
                  if os.path.getsize(download_to_file) == 0:
                      os.remove(download_to_file)
                      msg = "%s seems to be empty" % (filename,)
                      raise InvenioFileCopyError(msg)
                  break
          else:
              msg = "%s is not in one of the allowed paths." % (path,)
              raise InvenioFileCopyError()
      except Exception as e:
          msg = "Impossible to copy the local file '%s' to %s: %s" % \
                (filename, download_to_file, str(e))
          raise InvenioFileCopyError(msg)
  
      return download_to_file
docs: Copies a local file to Invenio's temporary directory.
  
      @param filename: the name of the file to copy
      @type filename: string
  
      @param download_to_file: the path to save the file to
      @type download_to_file: string
  
      @return: the path of the temporary file created
      @rtype: string
      @raise StandardError: if something went wrong