1 package Catalyst::Request::Upload;
4 use base 'Class::Accessor::Fast';
9 __PACKAGE__->mk_accessors(qw/filename size tempname type/);
11 sub new { shift->SUPER::new( ref( $_[0] ) ? $_[0] : {@_} ) }
15 Catalyst::Request::Upload - Catalyst Request Upload Class
31 This is the Catalyst Request Upload class, which provides a set of accessors
38 =item $upload->copy( $target [, $bufferlen ] )
40 Copies tempname using C<File::Copy>. Returns true for success, false otherwise.
45 my ( $self, $target, $buffer ) = @_;
46 return File::Copy::copy( $self->tempname, $target, $buffer );
51 Opens tempname and returns a C<IO::File> handle.
58 my $fh = IO::File->new( $self->tempname, IO::File::O_RDONLY )
59 or die( "Can't open ", $self->tempname, ": ", $! );
64 =item $upload->filename
66 Contains client supplied filename.
70 Creates a new filename linked to the old filename. Returns true for
71 success, false otherwise.
73 $upload->link('/my/path');
78 my ( $self, $target ) = @_;
79 return CORE::link( $self->tempname, $target );
84 Contains size of the file in bytes.
86 =item $upload->tempname
88 Contains path to the temporary spool file.
92 Contains client supplied Content-Type.
98 Sebastian Riedel, C<sri@cpan.org>
99 Christian Hansen, C<ch@ngmedia.com>
103 This program is free software, you can redistribute it and/or modify
104 it under the same terms as Perl itself.