Name

uploadhelper — display file upload widget

DESCRIPTION

EXAMPLES

No examples are available at this time. We do consider this a problem and will try to supply some.

NOTES

File upload has to be enabled in the HTML form containing this widget. Also this widget depends on the process_filter form profile.

AVAILABILITY

uploadhelper is available in Interchange versions:

4.6.0-5.9.0 (git-head)

SOURCE

Interchange 5.9.0:

Source: code/Widget/uploadhelper.widget
Lines: 51


# Copyright 2005-2007 Interchange Development Group and others
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.  See the LICENSE file for details.
# 
# $Id: uploadhelper.widget,v 1.7 2009-05-20 09:39:19 racke Exp $

CodeDef uploadhelper  Widget  1
CodeDef uploadhelper  Description File upload
CodeDef uploadhelper  Routine <<EOR
sub {
# $column, $value, $record->{outboard}, $record->{width}
  my ($opt) = @_;

my $name = $opt->{name};
my $val  = $opt->{value};
my $umask = $opt->{umask} || '022';
my $path = $opt->{path} || $opt->{outboard};
my $size = $opt->{cols} || $opt->{width};

$path =~ s:^/+::;
my $view_url;
$size = qq{ SIZE="$size"} if $size > 0;
my $out = '';
if ($val) {
if($path) {
  my $base = $::Variable->{UI_BASE} || 'admin';
  my $view_url = Vend::Interpolate::tag_area("$base/do_view", "$path/$val");
  $out .= qq{<A HREF="$view_url">};
}
$out .= $val;
  if ($path) {
    $out .= "</A>";
    $out .= qq{<input type="checkbox" name="ui_upload_file_delete:$name" value="1">};
    $out .= errmsg('Delete');
  }
  $out .= qq{&nbsp;<INPUT TYPE=file NAME="$name" VALUE="$val">
<INPUT TYPE=hidden NAME="ui_upload_file_path:$name" VALUE="$path">
<INPUT TYPE=hidden NAME="$name" VALUE="$val">
<INPUT TYPE=hidden NAME="ui_upload_umask:$name" VALUE="$umask">};      
  }
else {
      $out = qq{<INPUT TYPE=hidden NAME="ui_upload_file_path:$name" VALUE="$path">
<INPUT TYPE=file NAME="$name"$size>
<INPUT TYPE=hidden NAME="ui_upload_umask:$name" VALUE="$umask">};
  }
return $out;
}
EOR

AUTHORS

Interchange Development Group

SEE ALSO

uploadblob(7ic), imagehelper(7ic)

DocBook! Interchange!