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_to
40 Copies tempname using C<File::Copy>. Returns true for success, false otherwise.
42 $upload->copy_to('/path/to/target');
48 return File::Copy::copy( $self->tempname, @_ );
53 Opens tempname and returns a C<IO::File> handle.
60 my $fh = IO::File->new( $self->tempname, IO::File::O_RDONLY )
61 or die( "Can't open ", $self->tempname, ": ", $! );
66 =item $upload->filename
68 Contains client supplied filename.
70 =item $upload->link_to
72 Creates a hard link to the tempname. Returns true for success,
75 $upload->link_to('/path/to/target');
80 my ( $self, $target ) = @_;
81 return CORE::link( $self->tempname, $target );
86 Contains size of the file in bytes.
88 =item $upload->tempname
90 Contains path to the temporary spool file.
94 Contains client supplied Content-Type.
100 Sebastian Riedel, C<sri@cpan.org>
101 Christian Hansen, C<ch@ngmedia.com>
105 This program is free software, you can redistribute it and/or modify
106 it under the same terms as Perl itself.