> 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/es/aplicaciones/components/inputs/upload.md).

# Subir

El componente UDUpload se utiliza para subir ficheros a Universal Apps. Puede procesar los ficheros que sube el usuario. Recibirá los datos del fichero, un nombre de fichero y el tipo de fichero si el navegador web puede determinarlo.

Este componente funciona con [UDForm](/powershell-universal/es/aplicaciones/components/inputs/form.md) y [UDStepper](/powershell-universal/es/aplicaciones/components/navigation/stepper.md).

## Subir un fichero

{% hint style="warning" %}
La carga solo admite ficheros de hasta 2 GB de tamaño.
{% endhint %}

Sube un fichero y muestra el contenido mediante un toast.

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

El cuerpo del bloque de script `OnUpload` es una cadena JSON con el siguiente formato.

```javascript
{
  data: "base64 encoded string of data",
  name: "file name of the file uploaded",
  type: "file type as determined by the browser"
}
```

El `$EventData` es un objeto con la siguiente estructura.

```csharp
public class Upload
{
    public string Name { get; set; }
    public string FileName { get; set; }
    public DateTime TimeStamp { get; set; }
    public string ContentType { get; set; }
    public string Type => ContentType;
}
```

## Subir un fichero con un formulario

Sube un fichero como parte de un UDForm.

```powershell
New-UDForm -Content {
    New-UDUpload -Id 'myFile' -Text 'Upload File'
} -OnSubmit {
    Show-UDToast $Body 
}
```

El cuerpo del bloque de script `OnSubmit` es el mismo que verá con cualquier formulario y el fichero se incluirá como uno de los campos del formulario.

## Ejemplo: subir un fichero y guardarlo en el directorio temporal

Este ejemplo permite a un usuario subir un fichero. Una vez subido el fichero, se guardará en el directorio temporal.

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

## API

[**New-UDUpload**](/powershell-universal/es/comandos-de-powershell/new-udupload.md)


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.devolutions.net/powershell-universal/es/aplicaciones/components/inputs/upload.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
