Uploading files to S3 bucket - Python Django
<p>I want to put a string (which is an xml response) into a file and then upload it to a amazon s3 bucket. Following is my function in Python3</p>

<pre><code>def excess_data(user, resume):
    res_data = BytesIO(bytes(resume, "UTF-8"))
    file_name = 'name_of_file/{}_resume.xml'.format(user.id)
    s3 = S3Storage(bucket="Name of bucket", endpoint='s3-us-west-2.amazonaws.com')
    response = s3.save(file_name, res_data)
    url = s3.url(file_name)
    print(url)
    print(response)
    return get_bytes_from_url(url)
</code></pre>

<p>However, when I run this script I keep getting the error - <code>AttributeError: Unable to determine the file's size.</code> Any idea how to resolve this?</p>

<p>Thanks in advance!</p>