Product: PowerShell Universal
Version: 5.6.6
New-UDUpload control not working if I put it in one of the pages in an App.
but it works if the control is in the App
am on 5.6.1 and maybe that is a difference, but in my apps (on pages) UDUpload is working fine (more or less)
maybe provide your codeā¦
New-UDUpload -Text "Upload" -OnUpload {
Show-UDToast $Body
} -Id 'upload1'
took the example from PU docs ![]()
Show-UDToast "$Body"
yup, something must be broken.
on 5.6.1 it works even without double quotes
I am having troubles too.
When using this code
New-UDUpload -Id ācsvUploadā -Text āUpload Csvā -Accept ā.csvā -OnUpload {
$Data = $Body | ConvertFrom-Json
$bytes = [System.Convert]::FromBase64String($Data.Data)
[System.IO.File]::WriteAllBytes(ā$env:temp$($Data.Name)ā, $bytes)
$Page:Filepath = ā$env:temp$($Data.Name)ā
Sync-UDElement -Id āUploadCompleteā
}
I am getting
I tried the basic
New-UDUpload -OnUpload {
Show-UDToast $Body.Data
}
Getting an error too,

Issue remains in 5.6.8
I am on 5.6.8 as well.
It seems your issue is the show-udtoast.
Try the following:
New-UDPage -Url "/upload" -Name "upload" -Content {
New-UDUpload -OnUpload {
Show-UDToast $($Body | convertto-json) -duration 10000 -BackgroundColor gold
}
}
Yow will notice that there is much more in $Body but just the name or the data.
JSON helps you to understand the structure.
You can then use each value as needed.
Even better is using a textbox to display the contents.
New-UDPage -Url "/upload" -Name "upload" -Content {
New-UDUpload -OnUpload {
Show-UDToast $($Body | convertto-json) -duration 10000 -CloseOnClick -BackgroundColor gold
Set-UDElement -Id "debug" -Properties @{value=$($body|convertto-json)}
}
New-UDTextbox -Disabled -Multiline -Id "debug" -FullWidth
}
thanks, I tested again and it seems working without -duration as well.
thanks!
Hi, thanks.
Eventually it was related to permissions, our svc account used to run PSU didnāt have permissions to write on that temp folder, hence JSON file showing an empty object.