Jifty::Web::Form::Field::Uploads - File uploads field


Jifty documentation Contained in the Jifty distribution.

Index


Code Index:

NAME

Top

Jifty::Web::Form::Field::Uploads - File uploads field

DESCRIPTION

Top

An input field that renders using <input type="file" />. The argument value that the action receives from this field via argument_value in Jifty::Action will be a filehandle, which can be read in the usual ways.

render_widget

Renders the file upload widget.

render_value

The 'value', rendered, is empty so that BLOBs and the like don't get streamed to the browser.

classes

Add 'upload' to the rest of the classes


Jifty documentation Contained in the Jifty distribution.
use warnings;
use strict;
 
package Jifty::Web::Form::Field::Uploads;

use base qw/Jifty::Web::Form::Field/;

sub render_widget {
    my $self  = shift;
    my $field = qq!<div class="uploads">!;
    $field .= qq!<input type="file" name="@{[ $self->input_name ]}" !;
    $field .= $self->_widget_class();
    $field .= $self->javascript;
    $field .= qq!/>!;
    $field .= qq!<a href="#" class="attach-more">!;
    $field .= _('Attach another file');
    $field .= qq!</a></div>!;
    Jifty->web->out($field);
    '';
}


sub render_value {
    '';
}

sub classes {
    my $self = shift;
    return join(' ', 'upload', ($self->SUPER::classes));
}

1;