1Dancer::Request::UploadU(s3e)r Contributed Perl DocumentaDtainocner::Request::Upload(3)
2
3
4

NAME

6       Dancer::Request::Upload - class representing file uploads requests
7

VERSION

9       version 1.3400
10

SYNOPSIS

12           # somewhere in your view:
13           <form action="/upload" method="POST" enctype="multipart/form-data">
14             <input type="file" name="filename">
15             <input type="submit">
16           </form>
17
18           # and then in your application handler:
19           post '/upload' => sub {
20             my $file = request->upload('filename');
21             $file->copy_to($upload_dir);  # or whatever you need
22           };
23

DESCRIPTION

25       This class implements a representation of file uploads for Dancer.
26       These objects are accessible within route handlers via the
27       request->uploads keyword. See Dancer::Request for details.
28

METHODS

30       filename
31           Returns the filename as sent by the client.
32
33       basename
34           Returns basename for "filename".
35
36       tempname
37           Returns the name of the temporary file the data has been saved to.
38
39           This will be in e.g. /tmp, and given a random name, with no file
40           extension.
41
42       link_to
43           Creates a hard link to the temporary file. Returns true for
44           success, false for failure.
45
46               $upload->link_to('/path/to/target');
47
48       file_handle
49           Returns a read-only file handle on the temporary file.
50
51       content
52           Returns a scalar containing the contents of the temporary file.
53
54       copy_to
55           Copies the temporary file using File::Copy. Returns true for
56           success, false for failure.
57
58               $upload->copy_to('/path/to/target')
59
60       size
61           The size of the upload, in bytes.
62
63       headers
64           Returns a hash ref of the headers associated with this upload.
65
66       type
67           The Content-Type of this upload.
68

AUTHORS

70       This module as been written by Alexis Sukrieh, heavily based on
71       Plack::Request::Upload. Kudos to Plack authors.
72

SEE ALSO

74       Dancer
75

AUTHOR

77       Dancer Core Developers
78
80       This software is copyright (c) 2010 by Alexis Sukrieh.
81
82       This is free software; you can redistribute it and/or modify it under
83       the same terms as the Perl 5 programming language system itself.
84
85
86
87perl v5.28.0                      2018-06-15        Dancer::Request::Upload(3)
Impressum