---
name: "Dancer2::Core::Request::Upload"
section: "3pm"
platform: "linux"
package: "libdancer2-perl"
version: "1.1.2+dfsg-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Dancer2::Core::Request::Upload"
---

# Dancer2::Core::Request::Upload(3pm)

Class representing file upload requests

## NAME

Dancer2::Core::Request::Upload - Class representing file upload requests

## VERSION

version 1.1.2

## DESCRIPTION

This class implements a representation of file uploads for Dancer2. These objects are accessible within route handlers via the request-\>uploads keyword. See Dancer2::Core::Request for details.

## ATTRIBUTES

### filename

Filename as sent by client. optional. May not be undef.

### tempname

The name of the temporary file the data has been saved to. Optional. May not be undef.

### headers

A hash ref of the headers associated with this upload. optional. is read-write and a HashRef.

### size

The size of the upload, in bytes. Optional.

## METHODS

### my $filename=$upload-\>filename;

Returns the filename (full path) as sent by the client.

### my $tempname=$upload-\>tempname;

Returns the name of the temporary file the data has been saved to.

For example, in directory /tmp, and given a random name, with no file extension.

### my $href=$upload-\>headers;

Returns a hashRef of the headers associated with this upload.

### my $fh=$upload-\>file\_handle;

Returns a read-only file handle on the temporary file.

### $upload-\>copy\_to('/path/to/target')

Copies the temporary file using File::Copy. Returns true for success, false for failure.

### $upload-\>link\_to('/path/to/target');

Creates a hard link to the temporary file. Returns true for success, false for failure.

### my $content=$upload-\>content;

Returns a scalar containing the contents of the temporary file.

### my $basename=$upload-\>basename;

Returns basename for "filename".

### $upload-\>type

Returns the Content-Type of this upload.

## SEE ALSO

Dancer2

## AUTHOR

Dancer Core Developers

## COPYRIGHT AND LICENSE

This software is copyright (c) 2024 by Alexis Sukrieh.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
