> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/powershell-universal/da/powershell-kommandoer/new-udupload.md).

# New-UDUpload

New-UDUpload føjer et filuploadkontrolelement til PowerShell Universal og fungerer sammen med komponenterne New-UDForm og New-UDStepper.

### Synopsis

Upload filer

### Syntaks

```powershell
New-UDUpload [[-Id] <String>] [[-Accept] <String>] [[-OnUpload] <Endpoint>] [[-OnUploadProgress] <Endpoint>] [[-Text] <String>] [[-Variant] <String>] [[-Color] <String>] [[-ClassName] <String>] [-HideUploadedFileName] [-Multiple] [-ShowLoading] [[-LoadingIndicator] <Object>] [[-LoadingPosition] <String>] [[-Icon] <Object>] [[-IconAlignment] <String>] [[-Style] <Hashtable>] [[-Aria] <ScriptBlock>] [<CommonParameters>]
```

### Beskrivelse

Upload filer. Denne komponent fungerer sammen med UDForm og UDStepper.

### Parametre

#### -Id

Id'et for uploaderen.

```
Required?                    false
Position?                    1
Default value                [Guid]::NewGuid()
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Accept

De filtyper, der skal accepteres. Som standard accepterer denne komponent alle filer.

```
Required?                    false
Position?                    2
Default value                *
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -OnUpload

En scriptblok, der skal udføres, når en fil uploades. Parameteren $body vil indeholde JSON i følgende format:

{ data: 'base64-kodet streng med fildata', name: 'filnavn', type: 'filtype, hvis den kendes' }

$EventData vil indeholde en klasse med følgende egenskaber:

public string Name { get; set; } public string FileName { get; set; } public DateTime TimeStamp { get; set; } public string ContentType { get; set; } public string Type => ContentType;

```
Required?                    false
Position?                    3
Default value
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -OnUploadProgress

Et slutpunkt, der kaldes, efterhånden som uploadforløbet ændres. `$EventData` indeholder `fileName`, `fileIndex`, `fileCount`, `fileProgress`, `totalProgress`, `bytesUploaded`, `totalBytes`, `fileSize` og `uploadedFileSize`.

```
Required?                    false
Position?                    named
Default value
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Text

Teksten, der skal vises på uploadknappen.

```
Required?                    false
Position?                    4
Default value                Upload
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Variant

Varianten af knappen. Standardværdien er contained. Gyldige værdier: "text", "outlined", "contained"

```
Required?                    false
Position?                    5
Default value                contained
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Color

Farven på knappen. Standardværdien er 'default'. Gyldige værdier: "default", "primary", "secondary", "inherit"

```
Required?                    false
Position?                    6
Default value                primary
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -ClassName

En CSS-klasse, der skal anvendes på knappen.

```
Required?                    false
Position?                    7
Default value
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -HideUploadedFileName

Skjuler filnavnsteksten, der vises efter upload

```
Required?                    false
Position?                    named
Default value                False
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Multiple

Tillader, at flere filer vælges og uploades. Med denne switch modtager handleren `-OnUpload` et array af uploadobjekter i `$EventData`.

```
Required?                    false
Position?                    named
Default value                False
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -ShowLoading

Viser en indlæsningssnurre, mens OnClick-hændelseshandleren kører.

```
Required?                    false
Position?                    named
Default value                False
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -LoadingIndicator

Et brugerdefineret element, der vises i stedet for den indbyggede spinner for -ShowLoading

```
Required?                    false
Position?                    8
Default value
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -LoadingPosition

Placeringen af indlæsningsindikatoren. Gyldige værdier er: 'start', 'end', 'center'

```
Required?                    false
Position?                    9
Default value                center
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Icon

Det ikon, der skal vises i stedet for standardikonet. Brug New-UDIcon til at oprette et ikon.

```
Required?                    false
Position?                    10
Default value
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -IconAlignment

Sådan justeres ikonet i knappen. Gyldige værdier er: "left", "right"

```
Required?                    false
Position?                    11
Default value                left
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Style

En hashtable med CSS-typografier, der anvendes på uploadkomponenten.

```
Required?                    false
Position?                    named
Default value
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Aria

En scriptblok med kald til `New-UDAriaAttribute`, der leverer ARIA- eller rolleattributter til uploadkontrolelementet.

```
Required?                    false
Position?                    named
Default value
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### Fælles parametre

Denne cmdlet understøtter de fælles parametre: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable og OutVariable. Se [about\_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216) for at få flere oplysninger.

### Output

### Eksempler

#### Eksempel 1: grundlæggende upload

```powershell
New-UDUpload -Text "Upload" -OnUpload {
    Show-UDToast $Body
} -Id 'upload1'
```

En grundlæggende uploadkomponent, der viser en toast, når en fil uploades.

#### Eksempel 2: skjul filnavn

```powershell
New-UDUpload -Text "Upload" -OnUpload {
    Show-UDToast $Body
} -Id 'upload2' -HideUploadedFileName
```

Skjuler filnavnsteksten, der vises efter upload.

#### Eksempel 3: ikon

```powershell
New-UDUpload -Text "Upload" -OnUpload {
    Show-UDToast $Body
} -Id 'upload3' -Icon (New-UDIcon -Icon 'Upload')
```

Uploadkomponent med et ikon i stedet for standardikonet.

#### Eksempel 4: ikonjustering

```powershell
New-UDUpload -Text "Upload" -OnUpload {
    Show-UDToast $Body
} -Id 'upload4' -IconAlignment 'right' -Icon (New-UDIcon -Icon 'Upload')
```

Uploadkomponent med et ikon på højre side af knappen.

#### Eksempel 5: Variant

```powershell
New-UDUpload -Text "Upload" -OnUpload {
    Show-UDToast $Body
} -Id 'upload5' -Variant 'text'
```

Uploadkomponent med en tekstvariant.

#### Eksempel 6: Accept

```powershell
New-UDUpload -Text "Upload" -OnUpload {
    Show-UDToast $Body
} -Id 'upload6' -Accept ".jpg"
```

Uploadkomponent, der kun accepterer .jpg-filer.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.devolutions.net/powershell-universal/da/powershell-kommandoer/new-udupload.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
