1Dancer2::Core::Request:U:sUeprloCaodn(t3r)ibuted Perl DoDcaunmceenrt2a:t:iCoonre::Request::Upload(3)
2
3
4
6 Dancer2::Core::Request::Upload - Class representing file upload
7 requests
8
10 version 0.400000
11
13 This class implements a representation of file uploads for Dancer2.
14 These objects are accessible within route handlers via the
15 request->uploads keyword. See Dancer2::Core::Request for details.
16
18 filename
19 Filename as sent by client. optional. May not be undef.
20
21 tempname
22 The name of the temporary file the data has been saved to. Optional.
23 May not be undef.
24
25 headers
26 A hash ref of the headers associated with this upload. optional. is
27 read-write and a HashRef.
28
29 size
30 The size of the upload, in bytes. Optional.
31
33 my $filename=$upload->filename;
34 Returns the filename (full path) as sent by the client.
35
36 my $tempname=$upload->tempname;
37 Returns the name of the temporary file the data has been saved to.
38
39 For example, in directory /tmp, and given a random name, with no file
40 extension.
41
42 my $href=$upload->headers;
43 Returns a hashRef of the headers associated with this upload.
44
45 my $fh=$upload->file_handle;
46 Returns a read-only file handle on the temporary file.
47
48 $upload->copy_to('/path/to/target')
49 Copies the temporary file using File::Copy. Returns true for success,
50 false for failure.
51
52 $upload->link_to('/path/to/target');
53 Creates a hard link to the temporary file. Returns true for success,
54 false for failure.
55
56 my $content=$upload->content;
57 Returns a scalar containing the contents of the temporary file.
58
59 my $basename=$upload->basename;
60 Returns basename for "filename".
61
62 $upload->type
63 Returns the Content-Type of this upload.
64
66 Dancer2
67
69 Dancer Core Developers
70
72 This software is copyright (c) 2022 by Alexis Sukrieh.
73
74 This is free software; you can redistribute it and/or modify it under
75 the same terms as the Perl 5 programming language system itself.
76
77
78
79perl v5.36.0 2023-01-20 Dancer2::Core::Request::Upload(3)