使用python SDK将文件上传到对象存储

问题描述

我正在将Python SDK用于OCI。我尝试了“上传管理器”示例,并且当我尝试从文件系统上载文件时,它的工作正常。但是我必须将此python代码公开为REST服务(使用flask),要上传到对象存储的文件将作为REST的有效负载在这种情况下,它是否必须是多部分/混合的内容类型,还是也可以是多部分/表单数据?

解决方法

@ user1945183,您是否要问Upload Manager是否可以支持多部分/表单数据?是的,Upload Manager可以接受multipart / form-data。

Upload Manager使用对象存储的CreateMultipartUpload API。您可以了解有关CreateMultipartUpload API文档的更多信息。

CreateMultipartUploadDetails Reference中,您会发现content-type是可选的,并且对对象存储行为没有影响。

The optional Content-Type header that defines the standard MIME type format of 
the object to upload. Specifying values for this header has no effect on 
Object Storage behavior. Programs that read the object determine what to do 
based on the value provided. For example,you could use this header to 
identify and perform special operations on text only objects.