建议支持 powershell代码实现上传
windev001 opened this issue · comments
以前一直用国外某网盘api上传外链接图片, 但最近不能用了,
请问能支持用类似下面的powershell代码来上传吗? 如果能支持就更简单了, 感谢!
$Token = "改成你的token"
$filePath = "$env:UserProfile\Desktop\a.jpg"
$uploadUrl = "https://picx.xpoet.cn/upload"
$wc = New-Object System.Net.WebClient
$wc.Headers.Add("Content-Type", "application/json")
$fileContent = Get-Content -Path $filePath -Encoding Byte
$fileBase64 = [System.Convert]::ToBase64String($fileContent)
$requestBody = @{ Token = $Token; img = $fileBase64 }
$jsonObject = ConvertTo-Json -InputObject $requestBody
$response = $wc.UploadString($uploadUrl, "POST", $jsonObject)
Write-Host (ConvertFrom-Json $response).url