wsl2001
October 13, 2021, 12:30am
1
New-UDUpload -OnUpload {
Show-UDToast $Body
}
return powershelluniversal.upload after selecting a simple .txt file.
tried the following as per docs
New-UDUpload -Text 'Upload Image' -OnUpload {
$Data = $Body | ConvertFrom-Json
$bytes = [System.Convert]::FromBase64String($Data.Data)
[System.IO.File]::WriteAllBytes("$env:temp\$($Data.Name)", $bytes)
}
adam
October 13, 2021, 12:41am
2
Looks like a bug. Try this:
New-UDUpload -OnUpload {
Show-UDToast $Body.Data
}
wsl2001
October 13, 2021, 12:46am
3
this is what am getting with your provided code
adam
October 13, 2021, 1:23am
4
Thats the base64 encoded data from the file. This would write it down.
New-UDUpload -Text 'Upload Image' -OnUpload {
$bytes = [System.Convert]::FromBase64String($Body.Data)
[System.IO.File]::WriteAllBytes("$env:temp\$($Body.FileName)", $bytes)
}
Files are also now written to disk automatically.
New-UDUpload -Text 'Upload Image' -OnUpload {
Show-UDToast $Body.FileName
}
am getting an error now about the path, how to save the file for example to c:\temp now in the above example.
this code works to write the file to c:\temp, also as another note -Color is not working its erroring out if i use for example -Color “green” or if i try -Color “#26a69a ”
New-UDUpload -Text 'Upload Image' -OnUpload {
$bytes = [System.Convert]::FromBase64String($Body.Data)
[System.IO.File]::WriteAllBytes("c:\temp\$($Body.Name)", $bytes)
adam
October 13, 2021, 1:45am
7
Ok. I’ll circle back on this tomorrow. Seems like we might need to put a bug fix release out.
I agree PSU main functionalities should always be working in every release.