def upload(params, file_path, file_contents, apibase, password):
    """ Upload a file via the API append.php form input provision thingie.
        This allows uploads to either target S3 or the app itself.
    """

    params.update(dict(password=password,
                       dirname=dirname(file_path),
                       mimetype=(guess_type(file_path)[0] or '')))

    res = requests.get(urljoin(apibase, '/append.php'), params=params, headers=dict(Accept='application/paperwalking+xml'))