I'm trying to save file to bucket:
if file and allowed_file(file.filename):
filename = secure_filename(file.filename)
try:
minioClient.make_bucket("testbuck", location = "us-east-1")
except BucketAlreadyOwnedByYou as err:
pass
except BucketAlreadyExists as err:
pass
except ResponseError as err:
raise
else:
try:
print(filename)
minioClient.fput_object('testbuck', filename, image)
except ResponseError as err:
print(err)
But get errors: Message: {0}'.format(error.message)) InvalidXMLError: InvalidXMLError: message: "Error" XML is not parsable. Message: syntax error: line 1, column 0
Message: {0}'.format(error.message)) InvalidXMLError: InvalidXMLError: message: "Error" XML is not parsable. Message: syntax error: line 1, column 0
I'm newby in backend and flask and can't figure out what I am doing wrong! Thank for you patience
The pymino's minioClient.fput_object() method expects existing bucket name, object name to be kept and filepath of the file to be uploaded.
Usage :
minioClient.fput_object( bucket_name, object_name, filepath)
Add the following in the beginning Replace image
with the filepath.
UPLOAD_FOLDER = '/path/to/the/uploads'
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER`
Add the following before making fput_object function:
filename = secure_filename(file.filename)
filepath = os.path.join(app.config['UPLOAD_FOLDER'], filename)
Example:
minioClient.fput_object( "testbuck", filename, filepath)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.