CGI-FileUpload

 view release on metacpan or  search on metacpan

cgi/cgi-fileupload-manager.pl  view on Meta::CPAN

    <th><input type='submit' value='remove' name='action'/></th>
  </td>
EOT
# TODO get creation time + set it coherent with sort
my $id=CGI::FileUpload::idcookie(query=>$query)->{id};
foreach(@fus){
  next unless $isAdmin || ($_->from_id() eq $id);
  my $status=$_->upload_status();
  print "  <tr>\n";
  print "    <td>".$_->file_orig()."</td>\n";
  print "    <td>".(ctime((stat($_->file('.properties')))[9]))."</td>\n";
  print "    <td>$status</td>\n";
  print "    <td>".(($status eq 'completed')?(-s $_->file()):'n/a')."</td>\n";
  print "    <td>".$_->from_ipaddr()."</td>\n";
  print "    <td>".$_->from_id()."</td>\n" if $isAdmin;
  print "    <td align='center'><input type='checkbox' name='key' value='".$_->key()."'/></td></tr>\n";
}
print <<EOT;
</table>
</form>
<form >

lib/CGI/FileUpload/Manager.pm  view on Meta::CPAN

our (@ISA,@EXPORT,@EXPORT_OK);
@ISA=qw (Exporter);
@EXPORT=qw(&ls &lskey);
@EXPORT_OK=qw();

sub lskey{
  my %tmp;
  foreach(glob CGI::FileUpload::uploadDirectory()."/*.properties"){
    my $k=basename($_);
    $k=~s/\.properties$//;
    $tmp{$k}=(stat($_))[9];
  }
  return sort {$tmp{$b} <=> $tmp{$a}} keys %tmp;
}

sub ls{
  my @keys=lskey();
  my @ret;
  foreach(@keys){
    push @ret, CGI::FileUpload->new(key=>$_);
  }



( run in 0.609 second using v1.01-cache-2.11-cpan-49f99fa48dc )