3.Upload Files and Folders
3.1 Upload a single file
upload_file(bucket_name, object_name, file_path, replace=False)
Uploads a file to a bucket. Use the bucket_name
to select the bucket, and object_name
to select the path and file name of the uploaded file. file_path
is the local path of the file.
Parameters
bucket_name: The name of the bucket
object_name: The object name of the file ex.
'folder1/file.png'
will upload the file asfile.png
insidebucket_name/folder1
file_path: The local file path
replace: File's of the same name cannot be uploaded. When replace is set to True, it will overwrite the previous file of the same name.
Return
Returns a File Object
3.2 Upload a folder
Uploads folder_path
as a MCS folder under bucket_name
/object_name
Parameters
bucket_name: The name of the bucket
object_name: The object name for the folder
folder_path: Local path of your folder
Return
Returns a list of File Objects
3.3 Upload as IPFS folder
Uploads folder_path
as an IPFS folder to MCS. This gives the folder its own CID, sharable to others.
Parameters
bucket_name: The name of the bucket
object_name: The object name for the folder
folder_path: Local path of your folder
Return
Returns a File Object for your IPFS folder
Last updated