V3 - Replacement for New-UDInputField

Is there a replacement for New-UDInputField in v3? Specifically, the switch for “type”. I need to allow my users to select a file (XLS) for upload. I watched an older video where Adam demonstrates selecting a CSV using New-UDInput and New-UDInputfiled -type CSV.

I realize v3 is still in beta, but was trying to do this project with v3 to get more familiar with it rather than sticking with 2.9.x as this one is going to take me a few months to complete.

Thanks!

Sorry for the bump, but was hoping for an answer to this.
I even tried to go back to 2.9.1 (beta5) and do the binaryFile input and its not working either.

This brings back nothing. $File is null.

New-UDInput -Title "Stuff" -Content {
   New-UDInputField -Type binaryFile -Name file 
} -Endpoint {
   param($File)

   $newFilePath = "D:\IIS\JSTest\$($File.FileName)"
   Show-UDToast -Message $newFilePath
   
   $fileStream = [IO.File]::Create($newFilePath)
   $stream = $File.OpenReadStream()
   $stream.CopyTo($fileStream)
   $fileStream.Dispose()
   $stream.Dispose()
}

Thanks.

There isn’t a v3 version of this yet. We need to implement the file upload dialog.

As for v2.9.1, I’ll have to look into that. That should work.

This will be available in tonight’s PSU build in UDv3.

You can use it stand alone:

        New-UDUpload -Text "Upload" -OnUpload {
            Show-UDToast $Body
        }

You can also use it within a form:

New-UDForm -Content {
            New-UDUpload -Text "Upload" 
        } -OnSubmit {
            Show-UDToast $Body
        }

The body will contain JSON in the following format:

    {
        data: 'base64 encoded string of file data',
        name: 'filename',
        type: 'type of file, if known'
    }
1 Like

I just downloaded the latest nightly build, but New-UDUpload doesn’t seem to be there.

The term ‘New-UDUpload’ is not recognized as the name of a cmdlet, function, script file, or operable program.

I double checked that I’m using the latest and that my project is pointing to it. I checked “dashboard.frameworks.ps1” to make sure I’m pointing at the correct directory.

Thanks.

We had a test failure last night so it didn’t publish the latest. I fixed it and will be publishing soon. Sorry for the issue.

Ah! Thank you. Thought I was going nuts. :slight_smile:

As always, you da man.
Will check back after the chiropractor visit. Sucks getting old.

lol I feel ya there…

The latest nightly is now published.

Lookin’ good! Thank you so much.

1 Like