< Back

Invoke-B2ItemUpload

Sun Jan 19, 2020 5:52 pm

NAME Invoke-B2ItemUpload



SYNOPSIS

The Invoke-B2ItemUpload cmdlet uploads files to a specified bucket.





SYNTAX

Invoke-B2ItemUpload [-BucketID] <String> [-Path] <String[]> [[-Force]] [-WhatIf] [-Confirm] [<CommonParameters>]





DESCRIPTION

The Invoke-B2ItemUpload cmdlet uploads files to a specified bucket.

When uploading a file keep in mind that:



- It must not exceed 5 billion bytes or 4.6 GB

- It's name must be a UTF-8 string with a max size of 1000 bytes.



An API key is required to use this cmdlet.





PARAMETERS

-BucketID <String>

The ID of the bucket to update.



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Path <String[]>

The file(s) to upload.



Required? true

Position? 2

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



-Force [<SwitchParameter>]

Used to bypass confirmation prompts.



Required? false

Position? 3

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Confirm [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

System.String



This cmdlet takes the AccountID and ApplicationKey as strings.





OUTPUTS

PS.B2.FileProperty



This cmdlet will output a PS.B2.FileProperty object holding the file properties.





-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Invoke-B2ItemUpload -BucketID 4a48fe8875c6214145260818 -Path '.\\hello.txt'



Name : hello.txt

FileInfo : @{author=Administrators}

Type : text/plain

Length : 38

BucketID : 4a48fe8875c6214145260818

AccountID : 30f20426f0b1

SHA1 : E1E64A1C6E535763C5B775BAAD2ACF792D97F7DA

ID : 4_z4a48fe8875c6214145260818_f1073d0771c828c7f_d20160131_m052759_c001_v0001000_t0014



The cmdlet above will upload the file hello.txt to the selected bucket ID and metadata about the

uploaded file will be returned if the cmdlet is successfull.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Invoke-B2ItemUpload -BucketID 4a48fe8875c6214145260818 -Path '.\\hello.txt','.\\world.txt'



Name : hello.txt

FileInfo : @{author=Administrators}

Type : text/plain

Length : 38

BucketID : 4a48fe8875c6214145260818

AccountID : 30f20426f0b1

SHA1 : E1E64A1C6E535763C5B775BAAD2ACF792D97F7DA

ID : 4_z4a48fe8875c6214145260818_f1073d0771c828c7f_d20160131_m052759_c001_v0001000_t0014



Name : world.txt

FileInfo : @{author=Administrators}

Type : text/plain

Length : 38

BucketID : 4a48fe8875c6214145260818

AccountID : 30f20426f0b1

SHA1 : E1E64A1C6E535763C5B775BAAD2ACF792D97F7DA

ID : 4_z4a48fe8875c6214145260818_f1073d0771c828c7f_d20160131_m052759_c001_v0001000_t0014



The cmdlet above will upload the files hello.txt and world.txt to the selected bucket ID.









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Get-ChildItem | Invoke-B2ItemUpload -BucketID 4a48fe8875c6214145260818



Name : hello.txt

FileInfo : @{author=Administrators}

Type : text/plain

Length : 38

BucketID : 4a48fe8875c6214145260818

AccountID : 30f20426f0b1

SHA1 : E1E64A1C6E535763C5B775BAAD2ACF792D97F7DA

ID : 4_z4a48fe8875c6214145260818_f1073d0771c828c7f_d20160131_m052759_c001_v0001000_t0014



Name : world.txt

FileInfo : @{author=Administrators}

Type : text/plain

Length : 38

BucketID : 4a48fe8875c6214145260818

AccountID : 30f20426f0b1

SHA1 : E1E64A1C6E535763C5B775BAAD2ACF792D97F7DA

ID : 4_z4a48fe8875c6214145260818_f1073d0771c828c7f_d20160131_m052759_c001_v0001000_t0014



The cmdlet above will upload all files returned by the Get-ChildItem cmdlet.











RELATED LINKS

https://www.backblaze.com/b2/docs/