New-UDUpload is not working

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)
}

Looks like a bug. Try this:

New-UDUpload -OnUpload {
    Show-UDToast $Body.Data
}

this is what am getting with your provided code

image

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)

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.