1 package Catalyst::Request::Upload;
4 use base 'Class::Accessor::Fast';
9 __PACKAGE__->mk_accessors(qw/filename size tempname type/);
14 Catalyst::Request::Upload - Catalyst Request Upload Class
30 This is the Catalyst Request Upload class, which provides a set of accessors
39 Constructor. Normally only for engine use.
43 sub new { shift->SUPER::new( ref( $_[0] ) ? $_[0] : {@_} ) }
45 =item $upload->copy_to
47 Copies tempname using C<File::Copy>. Returns true for success, false otherwise.
49 $upload->copy_to('/path/to/target');
55 return File::Copy::copy( $self->tempname, @_ );
60 Opens tempname and returns a C<IO::File> handle.
67 my $fh = IO::File->new( $self->tempname, IO::File::O_RDONLY )
68 or die( "Can't open ", $self->tempname, ": ", $! );
73 =item $upload->filename
75 Contains client supplied filename.
77 =item $upload->link_to
79 Creates a hard link to the tempname. Returns true for success,
82 $upload->link_to('/path/to/target');
87 my ( $self, $target ) = @_;
88 return CORE::link( $self->tempname, $target );
93 Contains size of the file in bytes.
95 =item $upload->tempname
97 Contains path to the temporary spool file.
101 Contains client supplied Content-Type.
107 Sebastian Riedel, C<sri@cpan.org>
108 Christian Hansen, C<ch@ngmedia.com>
112 This program is free software, you can redistribute it and/or modify
113 it under the same terms as Perl itself.