Reputation: 25
I am getting the error "'put_object() only accepts keyword arguments.' while uploading a memory uploaded file in S3.
upload_file1 = request.FILES.get('upload_file1')
file_name1 = upload_file1._name
upload_file_path = 'Client/' + client_id + '/' + file_name1
s3.put_object(settings.AWS_STORAGE_BUCKET_NAME,Body=upload_file1,Key=upload_file_path )
please suggest
Upvotes: 2
Views: 9344
Reputation: 11
Mention the parameter name while calling the method. For example:
s3.put_object(Bucket='your_bucket_name', Key='your_key', Body=Data)
Upvotes: 0
Reputation: 35146
You are not specifying your Bucket
with the parameter name.
Instead it should be
s3.put_object(Bucket=settings.AWS_STORAGE_BUCKET_NAME,Body=upload_file1,Key=upload_file_path )
Upvotes: 3