Result:
found more than 723 distributions - search limited to the first 2001 files matching your query ( run in 3.140 )


Apache-RequestNotes

 view release on metacpan or  search on metacpan

RequestNotes.pm  view on Meta::CPAN

#
# usage: PerlInitHandler Apache::RequestNotes
#        PerlSetVar  MaxPostSize 1024          optional size in bytes
#                                              allowed to be POSTed
#
#        PerlSetVar  DisableUploads On         forbid file uploads 
#        
#---------------------------------------------------------------------

use 5.004;
use mod_perl 1.21;

RequestNotes.pm  view on Meta::CPAN

  
  my $r         = shift;
  my $log       = $r->server->log;

  my $maxsize   = $r->dir_config('MaxPostSize') || 1024;
  my $uploads   = $r->dir_config('DisableUploads') =~ m/Off/i ? 0 : 1;

  my %cookies   = ();               # hash for cookie names and values

  $Apache::RequestNotes::err = undef;

RequestNotes.pm  view on Meta::CPAN

# parse the form data
#---------------------------------------------------------------------

  # this routine works for either a get or post request
  my $apr = Apache::Request->instance($r, POST_MAX => $maxsize,
                                          DISABLE_UPLOADS => $uploads);

  # I assume that Apache::RequestNotes is going to do the job of
  # of calling Apache::Request->new().  Hopefully, this is ok...
  my $status = $apr->parse;

  if ($status) {
    # I don't know what to do here, but rather than return
    # SERVER_ERROR, do something that says there was a parse failure.
    # GET data is still available, but POST looks hosed...
    # problems with uploads are caught here as well.

    $Apache::RequestNotes::err = $status;
   
    $log->error("Apache::RequestNotes encountered a parsing error!");
    $log->info("Exiting Apache::RequestNotes");

RequestNotes.pm  view on Meta::CPAN

  
#---------------------------------------------------------------------
# create an array of all Apache::Upload objects
#---------------------------------------------------------------------

  my @uploads = $apr->upload;    # all the Apache::Upload objects

  foreach my $upload (@uploads) {
    $log->info("\tupload: size = ", $upload->size,
       ", type = ", $upload->type) if $Apache::RequestNotes::DEBUG; 
  }

#---------------------------------------------------------------------
# put the form and cookie data in a pnote for access by other handlers
#---------------------------------------------------------------------

  $r->pnotes(INPUT => $input);
  $r->pnotes(UPLOADS => \@uploads) if @uploads;
  $r->pnotes(COOKIES => \%cookies) if %cookies;

#---------------------------------------------------------------------
# wrap up...
#---------------------------------------------------------------------

RequestNotes.pm  view on Meta::CPAN

  PerlInitHandler Apache::RequestNotes

some Perl*Handler or Registry script:

  my $input      = $r->pnotes('INPUT');   # Apache::Table reference
  my $uploads    = $r->pnotes('UPLOADS'); # Apache::Upload array ref
  my $cookies    = $r->pnotes('COOKIES'); # hash reference
  
  # GET and POST data
  my $foo        = $input->get('foo');

  # uploaded files
  foreach my $upload (@$uploads) {
    my $name     = $upload->name'
    my $fh       = $upload->fh;
    my $size     = $upload->size;
  }

  # cookie data
  my $bar        = $cookies->{'bar'};

RequestNotes.pm  view on Meta::CPAN


  o $input contains a reference to an Apache::Table object and can be
    accessed via Apache::Table methods - if a form contains both GET
    and POST data, both are available via $input.

  o $uploads contains a reference to an array containing all the
    Apache::Upload objects for the request, which can be used to
    access uploaded file information.

Once Apache::RequestNotes has been called, all other phases can have
access to the form input and cookie data without parsing it
themselves. This relieves some strain, especially when the GET or POST
data is required by numerous handlers along the way.

RequestNotes.pm  view on Meta::CPAN

translation, using RequestNotes as a PerlFixupHandler should work
just fine.  Keep in mind that Apache::RequestNotes returns OK, which
would preclude it's use in conjuction with other PerlTransHandlers
and PerlTypeHandlers (but it doesn't really belong there anyway).

MaxPostSize applies to file uploads as well as POST data, so if you
plan on uploading files bigger than 1K, you will need to the override
the default value.

$Apache::RequestNotes:err is set if libapreq reports a problem
parsing the form data, thus it can be used to verify whether $input
and $uploads contain valid objects.  Apache::RequestNotes will _not_
return SERVER_ERROR in the event libapreq encounters an error.  This
may change in future releases.

Verbose debugging is enabled by setting the variable
$Apache::RequestNotes::DEBUG to 1 or greater. To turn off all debug

 view all matches for this distribution


Apache-RewritingProxy

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

work.

Also added plenty of stuff to make cookies work a little better.

I fixed the version numbering to be consistent with the numbers under which
these files are being uploaded to CPAN.  This is really 0.5.  THere
had been some version cornfusion since I had cvs dump its own version
tag into the file.  Bad move.
----------------------------
revision 1.5
date: 1999/12/08 22:43:48;  author: khhaga01;  state: Exp;  lines: +114 -7

 view all matches for this distribution


Apache-SWIT

 view release on metacpan or  search on metacpan

lib/Apache/SWIT/HTPage.pm  view on Meta::CPAN


sub swit_update {
	my ($class, $r) = @_;
	my %args = %{ $r->param || {} };
	if ($r->body_status eq 'Success') {
		$args{ $r->upload($_)->name } = $r->upload($_) for $r->upload;
	}
		
	my $tested = $class->ht_root_class->ht_load_from_params(%args);
	my @errs = $tested->ht_validate;
	return $class->ht_swit_die('ht_swit_validate_die', \@errs, $r, $tested)

 view all matches for this distribution


Apache-SdnFw

 view release on metacpan or  search on metacpan

lib/Apache/SdnFw/lib/Core.pm  view on Meta::CPAN

	$str .= '>';

	return $str;
}

sub html_upload {

=head2 html_upload

 my $html = $s->html_upload($key,[$size],[$class],[$id]);

=cut

	my $s = shift;
	my $key = $s->escape(shift);

 view all matches for this distribution


Apache-Session-PHP

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

	* Fixed bug that previous session is not correctly cleared
	  Thanks to: Andy Lester <andy@petdance.com>
                     Ed Summers <esummers@cpan.org>

0.02  Wed Mar 27 03:16:44 JST 2002
	- CPAN upload problem

0.01  Wed Mar 27 02:00:47 2002
	- original version

 view all matches for this distribution


Apache-Session-SharedMem

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN


0.4   Mon Aug 26 10:37:18 2002
    - put some prerequisites in the Makefile.PL

0.31  Tue Mar 20 16:32:45 2001
    - Finally get round to uploading to CPAN. Forgot to put README in MANIFEST so try and delete and upload again. Which doens't work. So I just upped the version number;)

0.3   Mon Dec 18 09:50:26 2000
	- Changed Name. More tests, fixes in session removal code. Also IPC::ShareLite doesn't seem to work under Perl 5.6 :(

0.2   Mon Dec 11 16:50:40 2000

 view all matches for this distribution


Apache-SimpleTemplate

 view release on metacpan or  search on metacpan

SimpleTemplate.pm  view on Meta::CPAN

		}
	}

	if (($r) && ($r->method() eq 'POST') && ($r->header_in('Content-Length') > 0)) {

		# handle upload posts
		if ($r->header_in('Content-Type') =~ m/multipart\/form-data/i) {
			use CGI;
			$CGI::DISABLE_UPLOADS = 0;
			my $cgi = CGI->new();
			foreach my $k (keys %{$cgi->Vars}) { $form{$k} = $cgi->param($k); }
			use CGI::Upload;
			my $upload = CGI::Upload->new({ query => $cgi });
			$s->{upload} = $upload;
		}

		# handle other posts
		else {
			push @form, $r->content();

SimpleTemplate.pm  view on Meta::CPAN

  make
  make install

(** Version 0.06 works with mod_perl2 in compatibility mode. Older versions 
may work better with mod_perl1. The CGI library is needed if you want
file upload support.)

Then, to test it with Apache/mod_perl:

  1) put the httpd.conf lines above into your httpd.conf
  2) restart apache

 view all matches for this distribution


Apache-Sling

 view release on metacpan or  search on metacpan

lib/Apache/Sling/Content.pm  view on Meta::CPAN


    print <<"EOF";
Usage: perl $0 [-OPTIONS [-MORE_OPTIONS]] [--] [PROGRAM_ARG1 ...]
The following options are accepted:

 --additions or -A (file)          - File containing list of content to be uploaded.
 --add or -a                       - Add content.
 --auth (type)                     - Specify auth type. If ommitted, default is used.
 --copy or -c                      - Copy content.
 --delete or -d                    - Delete content.
 --filename or -n (filename)       - Specify file name to use for content upload.
 --help or -?                      - view the script synopsis and options.
 --local or -l (localPath)         - Local path to content to upload.
 --log or -L (log)                 - Log script output to specified log file.
 --man or -M                       - view the full script documentation.
 --move or -m                      - Move content.
 --pass or -p (password)           - Password of user performing content manipulations.
 --property or -P (property)       - Specify property to set on node.

lib/Apache/Sling/Content.pm  view on Meta::CPAN

#{{{ sub man
sub man {
    my ($content) = @_;

    print <<'EOF';
content perl script. Provides a means of uploading content into sling from the
command line. The script also acts as a reference implementation for the
Content perl library.

EOF

lib/Apache/Sling/Content.pm  view on Meta::CPAN

                $authn->{'LWP'} = $authn->user_agent( $sling->{'Referer'} );
                $authn->login_user();
                my $content =
                  Apache::Sling::Content->new( \$authn, $sling->{'Verbose'},
                    $sling->{'Log'} );
                $content->upload_from_file( ${ $config->{'additions'} },
                    $i, $sling->{'Threads'} );
                exit 0;
            }
            else {
                croak "Could not fork $i!";

lib/Apache/Sling/Content.pm  view on Meta::CPAN

            && defined ${ $config->{'remote'} } )
        {
            $content =
              Apache::Sling::Content->new( \$authn, $sling->{'Verbose'},
                $sling->{'Log'} );
            $success = $content->upload_file(
                ${ $config->{'local'} },
                ${ $config->{'remote'} },
                ${ $config->{'filename'} }
            );
        }

lib/Apache/Sling/Content.pm  view on Meta::CPAN

    return $success;
}

#}}}

#{{{sub upload_file
sub upload_file {
    my ( $content, $local_path, $remote_path, $filename ) = @_;
    $filename = defined $filename ? $filename : q{};
    my $res = Apache::Sling::Request::request(
        \$content,
        Apache::Sling::ContentUtil::upload_file_setup(
            $content->{'BaseURL'}, $local_path, $remote_path, $filename
        )
    );
    my $success  = Apache::Sling::ContentUtil::upload_file_eval($res);
    my $basename = $local_path;
    $basename =~ s/^(.*\/)([^\/]*)$/$2/msx;
    my $remote_dest =
      $remote_path . ( $filename ne q{} ? "/$filename" : "/$basename" );
    my $message = "Content: \"$local_path\" upload to \"$remote_dest\" ";
    $message .= ( $success ? 'succeeded!' : 'failed!' );
    $content->set_results( "$message", $res );
    return $success;
}

#}}}

#{{{sub upload_from_file
sub upload_from_file {
    my ( $content, $file, $fork_id, $number_of_forks ) = @_;
    $fork_id         = defined $fork_id         ? $fork_id         : 0;
    $number_of_forks = defined $number_of_forks ? $number_of_forks : 1;
    my $count = 0;
    if ( !defined $file ) {
        croak 'File to upload from not defined';
    }
    if ( open my ($input), '<', $file ) {
        while (<$input>) {
            if ( $fork_id == ( $count++ % $number_of_forks ) ) {
                chomp;
                $_ =~ /^(\S.*?),(\S.*?)$/msx
                  or croak 'Problem parsing content to add';
                my $local_path  = $1;
                my $remote_path = $2;
                $content->upload_file( $local_path, $remote_path, q{} );
                Apache::Sling::Print::print_result($content);
            }
        }
        close $input or croak 'Problem closing input!';
    }

lib/Apache/Sling/Content.pm  view on Meta::CPAN


=head2 run

Run content related actions.

=head2 upload_file

Upload a file into the system.

=head2 upload_from_file

Upload new content to the system based on definitions in a file.

=head2 view

 view all matches for this distribution


Apache-Solr

 view release on metacpan or  search on metacpan

lib/Apache/Solr/JSON.pm  view on Meta::CPAN

		$body      = \$self->json->encode($body);
	}

	# Solr server 3.6.2 seems not to detect the JSON input from the
	# body content, so requires this work-around
	# https://solr.apache.org/guide/6_6/uploading-data-with-index-handlers.html#UploadingDatawithIndexHandlers-JSONUpdateConveniencePaths
	$url =~ s!/update\?!/update/json?!;

	$self->SUPER::request($url, $result, $body, $body_ct);
}

 view all matches for this distribution


Apache-Stage

 view release on metacpan or  search on metacpan

Stage.pm  view on Meta::CPAN

  </Location>

=head1 DESCRIPTION

A staging place is a place where an author of an HTML document checks
the look and feel of a document before it's uploaded to the final
location. A staging place doesn't need to be a separate server, nor
need it be a mirror of the "real" tree, and not even a tree of
symbolic links. A sparse directory tree that holds nothing but the
staged files will do.

 view all matches for this distribution


Apache-Template

 view release on metacpan or  search on metacpan

lib/Apache/Template.pm  view on Meta::CPAN

    my $headers = $cfg->{ SERVICE_HEADERS } ||= [ ];
    push(@$headers, $item);
}

#------------------------------------------------------------------------
# TT2Params uri env pnotes uploads request            # add template vars
#------------------------------------------------------------------------

sub TT2Params($$@) {
    my ($cfg, $parms, $item) = @_;
    my $params = $cfg->{ SERVICE_PARAMS } ||= [ ];

lib/Apache/Template.pm  view on Meta::CPAN

=item TT2Params

Allows you to specify which parameters you want defined as template
variables.  Current permitted values are 'uri', 'env' (hash of
environment variables), 'params' (hash of CGI parameters), 'pnotes'
(the request pnotes hash), 'cookies' (hash of cookies), 'uploads' (a
list of Apache::Upload instances), 'request' (the Apache::Request
object) or 'all' (all of the above).

    TT2Params       uri env params uploads request

When set, these values can then be accessed from within any 
template processed:

    The URI is [% uri %]

 view all matches for this distribution


Apache-Test

 view release on metacpan or  search on metacpan

lib/Apache/TestClient.pm  view on Meta::CPAN


#this module provides some fallback for when libwww-perl is not installed
#it is by no means an LWP replacement, just enough for very simple requests

#this module does not and will never support certain features such as:
#file upload, http/1.1 (byteranges, keepalive, etc.), following redirects,
#authentication, GET body callbacks, SSL, etc.

use strict;
use warnings FATAL => 'all';

 view all matches for this distribution


Apache-Upload-Slurp

 view release on metacpan or  search on metacpan

Slurp.pm  view on Meta::CPAN

=head1 NAME

Apache::Upload::Slurp - Component to slurp all uploaded file

=head1 SYNOPSIS

    use Apache::Upload::Slurp ();
    my $obj = new Apache::Upload::Slurp;
    my $uploads = $obj->uploads;

=head1 DESCRIPTION

I<Apache::Upload::Slurp> put all uploaded files via 
I<application/x-www-form-urlencoded> and their information in an array
to be simply process by clients.

=head1 METHODS

=head2 new

Create a new I<Apache::Upload::Slurp> object and process uploads

    my $obj = new Apache::Upload::Slurp;

=cut

Slurp.pm  view on Meta::CPAN

	return $self;
}

sub _slurp {
	my $self		= shift;
	$self->{uploads} = {};
	my $r = Apache::Request->instance( Apache->request );
	for (my $upload = $r->upload; $upload; $upload = $upload->next) {
		my $file_info = {};
		my $fh = $upload->fh;
		if (defined $fh) {
			my $binary;
			while (<$fh>) {
					$binary .= $_;
			}
			$file_info->{data} 			= $binary;
			$file_info->{filename} 	= $upload->filename;
			$file_info->{size} 			= $upload->size;
			$file_info->{name} 			= $upload->name;
			$file_info->{type} 			= $upload->type;
			my $info = $upload->info;
			while (my($key, $val) = each %$info) {
				$file_info->{$key} = $val;
			}
			$self->{uploads}->{$file_info->{name}} = $file_info;
		}
  }
}

sub _slurp_single {
	my $self				= shift;
	my $upload_name = shift;
	return $self->{uploads}->{$upload_name} 
		if (exists $self->{uploads}->{$upload_name});
	my $r = Apache::Request->instance( Apache->request );
	my $upload = $r->upload($upload_name);
	my $file_info = {};
	my $fh = $upload->fh;
	if (defined $fh) {
		my $binary;
		while (<$fh>) {
				$binary .= $_;
		}
		$file_info->{data} 			= $binary;
		$file_info->{filename} 	= $upload->filename;
		# IE add all path to filename, remove it
		$file_info->{filename} =~ s/\w\:\\(.+\\)*//;
		$file_info->{size} 			= $upload->size;
		$file_info->{name} 			= $upload->name;
		$file_info->{type} 			= $upload->type;
		my $info = $upload->info;
		while (my($key, $val) = each %$info) {
			$file_info->{$key} = $val;
		}
		$self->{uploads}->{$file_info->{name}} = $file_info;
		return $file_info;
  }
}

=pod

=head2 uploads

Return an array or an arrayref with an hashref for every file uploaded.
The hashref has this structure:

=over 4

=item * data

Slurp.pm  view on Meta::CPAN


The filename from the client point of view

=item * size

The size of the uploaded file

=item * name

The name of the form field that uploaded file.

=item * type

The content type of the uploaded file.

=item * other keys 

From the additional header information for the uploaded file

=back
    
=cut

sub uploads {
	my $self = shift;
	$self->_slurp;
	my @uploads = values %{$self->{uploads}};
	return wantarray ? @uploads : \@uploads;
}

=head2 upload(form_name)

Return an hash or hashref (based on contest) with infos for the single upload
The hashref has this structure:

=over 4

=item * data

Slurp.pm  view on Meta::CPAN


The filename from the client point of view

=item * size

The size of the uploaded file

=item * name

The name of the form field that uploaded file.

=item * type

The content type of the uploaded file.

=item * other keys 

From the additional header information for the uploaded file

=back
    
=cut

sub upload {
	my $self = shift;
	my $upload_name = shift;
	my $ret = $self->_slurp_single($upload_name);
	return wantarray ? %$ret : $ret;
}

1;

=pod

=head1 LICENSE

Apache::Upload::Slurp - Component to slurp all uploaded file

Copyright (C) 2006 Bruni Emiliano <info AT ebruni DOT it>

This module is free software; you can redistribute it and/or modify it under the terms of
either:

 view all matches for this distribution


Apache-UploadMeter

 view release on metacpan or  search on metacpan

lib/Apache/UploadMeter.pm  view on Meta::CPAN

    my $r = shift;
    my $hook_data = shift; # joes says libapreq2 should use perl closures for
                           # implementing $hook_data - who am i to argue?
    ### Upload hook handler
    return sub {
	my ($upload, $new_data)=@_;
	my $len = length($new_data);
        my $hook_cache=new Cache::FileCache(\%cache_options);
        unless ($hook_cache) {
	    $r->log_reason("[Apache::UploadMeter] Could not instantiate FileCache.", __FILE__.__LINE__);
	    return Apache2::Const::DECLINED; 
	}
	my $oldlen=$hook_cache->get($hook_data."len") || 0;
	$len=$len+$oldlen;
	if ($oldlen==0)
	{
	    $r->log->notice("[Apache::UploadMeter] Starting upload $hook_data");
	    $hook_cache->set($hook_data."starttime",time());
	}
        unless ($hook_cache->get($hook_data."name") eq $upload->upload_filename) {
            my $name = $upload->upload_filename;
            $r->log->debug("[Apache::UploadMeter] Updating cache: $hook_data NAME --> $name");
            $hook_cache->set($hook_data."name",$name);
        }
	$r->log->debug("[Apache::UploadMeter] Updating cache: $hook_data LEN --> $len");
        $hook_cache->set($hook_data."len",$len);
        
        if ($r->pnotes("finished_upload")) {
            # Our filter deteced EOS.  Update finished, size == len
            $hook_cache->set($hook_data."size",$len);
        }
    };
}

lib/Apache/UploadMeter.pm  view on Meta::CPAN

    unless ($hook_cache) {
	$r->log_reason("[Apache::UploadMeter] Could not instantiate FileCache.", __FILE__.__LINE__);
        return Apache2::Const::SERVER_ERROR; 
    }
    # Initialize apreq
    $req->upload_hook(hook_handler($r, $u_id));
    my $rsize=$r->headers_in->{"Content-Length"};
    $hook_cache->set($u_id."size",$rsize);
    $r->log->notice("[Apache::UploadMeter] Initialized cache for $u_id");
    return Apache2::Const::DECLINED;
}

lib/Apache/UploadMeter.pm  view on Meta::CPAN

		$len=$hook_cache->get($hook_id."len") || undef;
		if (defined($len)) {
		    $problem=0;
		    last;
		}
		$r->log->info("[Apache::UploadMeter] Waiting for upload cache $hook_id to initialize ($i / $TIMEOUT)...");
		sleep 1;
		last if $c->aborted;
	    }
	}
	if ($problem) {
	    $r->custom_response(Apache2::Const::NOT_FOUND, "This upload meter is either invalid, or has expired.");
            return Apache2::Const::NOT_FOUND;
	}
    }
    my $size=$hook_cache->get($hook_id."size") || "Unknown";
    my $fname=$hook_cache->get($hook_id."name") || "Unknown";

lib/Apache/UploadMeter.pm  view on Meta::CPAN

    return Apache2::Const::OK;
}

### Support handlers (for debugging)

# Simple response handler for displaying upload information
sub r_handler
{
    my $r=shift;
    my $req = APR::Request::Apache2->handle($r);
    $r->no_cache(1);
    my $uploads=$req->upload;
    $r->content_type('text/plain');
    return Apache2::Const::OK if $r->header_only;
    $r->print("Results:\n");
    while (my ($field, $upload) = each %$uploads) {
	$r->print("Parsed upload field $field:\n\tFilename: ".$upload->upload_filename());
	$r->print("\n\tSize: ".$upload->upload_size()."\n\n");
    }
    $r->print("Done\n");
    return Apache2::Const::OK;
}

### Output filters
sub f_xml_uploadform {
    my ($f, $bb) = @_;
    my $bb_ctx = APR::Brigade->new($f->c->pool, $f->c->bucket_alloc);
    unless ($f->ctx) {
        my $config = $f->r->pnotes("Apache::UploadMeter::Config");
        my $handler = $config->{"UploadHandler"} || undef;

lib/Apache/UploadMeter.pm  view on Meta::CPAN

	my $output=<<"EOF";
<script type="text/javascript">
// <![CDATA[
function openUploadMeter()
{
    uploadWindow=window.open(\"${meter}?meter_id=${u_id}\",\"_new\",\"toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizeable=no,width=450,height=240\");
}
// ]]>
</script>
<noscript>You must use a JavaScript-enabled browser to use this page properly</noscript>
<form action=\"${handler}?hook_id=${u_id}\" method=\"post\" enctype=\"multipart/form-data\" onSubmit=\"openUploadMeter()\">

lib/Apache/UploadMeter.pm  view on Meta::CPAN

            $buf = ${$f->ctx}{leftover}.$buf if defined(${$f->ctx}{leftover});
            while ($buf=~/^(.*?)(<.*?>)(.*)/ms) {
                my ($pre,$tag);
                ($pre,$tag,$buf) = ($1,$2,$3);
                $outbuf.=$pre;
                if ($tag=~/\<\!--\s*?#uploadform\s*?--\>/i) {
                    $tag = ${$f->ctx}{output};
                }                
                $outbuf.=$tag;
            }
            $bb_ctx->insert_tail(APR::Bucket->new($bb_ctx->bucket_alloc, $outbuf));

lib/Apache/UploadMeter.pm  view on Meta::CPAN

    my $rv = $f->next->pass_brigade($bb_ctx);
    return $rv unless $rv == APR::Const::SUCCESS;
    return Apache2::Const::OK;
}

sub f_json_uploadform {
    my ($f, $bb) = @_;
    my $bb_ctx = APR::Brigade->new($f->c->pool, $f->c->bucket_alloc);
    unless ($f->ctx) {
        my $config = $f->r->pnotes("Apache::UploadMeter::Config");
        my $handler = $config->{"UploadHandler"} || undef;

lib/Apache/UploadMeter.pm  view on Meta::CPAN


    # If we've seen EOS, update the cache 
    if ($f->ctx) {
        my $req = APR::Request::Apache2->handle($f->r);
        my $u_id=$f->r->pnotes("u_id");
        $f->r->pnotes("finished_upload" => 1);
        my $hook_cache=new Cache::FileCache(\%cache_options);
        unless ($hook_cache) {
            $f->r->log_reason("[Apache::UploadMeter] Could not instantiate FileCache.", __FILE__.__LINE__);
            return Apache2::Const::DECLINED;
        }

lib/Apache/UploadMeter.pm  view on Meta::CPAN

sub __add_version_string {
    my $r = shift;
    $r->err_headers_out->add("X-Powered-By" => "Apache-UploadMeter/$VERSION");
}

sub upload_jit_handler($)
{
    my $r=shift;
    my $config = __lookup_config($r, "UploadHandler");
    unless ($config) {
        $r->log->warn("[Apache::UploadMeter] Couldn't find configuration data for url " . $r->uri);

lib/Apache/UploadMeter.pm  view on Meta::CPAN

    }
    $r->pnotes("Apache::UploadMeter::Config" => $config);
    $r->push_handlers("PerlFixupHandler",\&uf_handler);
    my $format = $config->{'MeterType'};
    if ($format=~/^XML$/i) {
        $r->add_output_filter(\&f_xml_uploadform);
    } elsif ($format=~/^JSON$/i) {
        $r->add_output_filter(\&f_json_uploadform);
    } elsif ($format=~/^NONE$/i) {
        # Do nothing - user-experience will be managed externally
    } else {
        $r->log->warn("[Apache::UploadMeter] Invalid meter type $format");
    }

lib/Apache/UploadMeter.pm  view on Meta::CPAN

                                 $tmp->{MeterType},
                                 );
    my $config = <<"EOC";
<Location $UH>
    Options +ExecCGI
    PerlInitHandler Apache::UploadMeter::upload_jit_handler
</Location>
<Location $UF>
    Options +ExecCGI
    PerlInitHandler Apache::UploadMeter::form_jit_handler
</Location>

lib/Apache/UploadMeter.pm  view on Meta::CPAN

1;
__END__

=head1 NAME

Apache::UploadMeter - Apache module which implements an upload meter for form-based uploads

=head1 SYNOPSIS

XML-based graphical meter
  (in httpd.conf)
  
  PerlLoadModule Apache::UploadMeter
  <UploadMeter MyUploadMeter>
      UploadForm    /form.html
      UploadHandler /perl/upload
      UploadMeter   /perl/meter
      MeterType     XML
  </UploadMeter>

  (in /form.html)
  <!--#uploadform-->
  <INPUT TYPE="FILE" NAME="theFile"/>
  <INPUT TYPE="SUBMIT"/>
  </FORM>

Web 2.0 JS-based graphical meter
  (in httpd.conf)
  
  PerlLoadModule Apache::UploadMeter
  <UploadMeter MyUploadMeter>
      UploadForm    /form.html
      UploadHandler /perl/upload
      UploadMeter   /perl/meter
      MeterType     JSON
  </UploadMeter>

  (in /form.html)
  <FORM ACTION="/perl/upload" ENCTYPE="multipart/form-data" METHOD="POST" class="uploadform">
  <INPUT TYPE="FILE" NAME="theFile"/>
  <INPUT TYPE="SUBMIT"/>
  </FORM>
  
  <DIV class="uploadmeter"></DIV>


=head1 ONLINE DEMO

An online demo of a (fairly) up-to-date version of the progress meter can be seen
at http://uploaddemo.beamartyr.net/  [To conserve bandwidth, this URL won't allow
more than 5MB of uploaded data.  An attempt to upload more than that will cause
the upload to be prematurely canceled, so try to ensure the total size of the
files to be uploaded there is less than 5MB]

=head1 DESCRIPTION

Apache::UploadMeter is a mod_perl module which implements a status-meter/progress-bar
to show realtime progress of uploads done using a form with enctype=multipart/form-data.

The software includes several built-in DHTML widgets to display the progress bar
out-of-the box, or alternatively you can create your own custom widgets.

To use the enclosed JavaScript powered widget, simply modify the E<lt>formE<gt> tag to
include class="uploadform".

To use the XML/XSL powered widget, simply replace the existing opening E<lt>FORME<gt>
tag, with the a special directive E<lt>!--#uploadform--E<gt>.

NOTE: To use this module, mod_perl MUST be built with StackedHandlers enabled.

=head1 CONFIGURATION

lib/Apache/UploadMeter.pm  view on Meta::CPAN


=item *

E<lt>UploadMeter I<MyMeter>E<gt>
Defines a new UploadMeter.  The I<MyMeter> parameter specifies a unique name
for this uploadmeter.  Currently, names are required and must be unique.

In a future version, if no name is given, a unique symbol will be generated
for the meter.

Each UploadMeter section requires at least 2 sub-parameters

lib/Apache/UploadMeter.pm  view on Meta::CPAN

=over

=item *
UploadForm

This should point to the URI on the server which contains the upload form with
the special E<lt>!--#uploadform--E<gt> tag.  Note that there should NOT be an
opening E<lt>FORME<gt> tag, but there SHOULD be a closing E<lt>/FORME<gt>
tag on the HTML page.

=item *
UploadHandler

This should point to the target (eg, ACTION) of the upload form.  The target
should already exist and do something useful.

=item *
UploadMeter

lib/Apache/UploadMeter.pm  view on Meta::CPAN

based, and XML-based.  The JSON is the new default; it's sexier, slicker, works
out-of-the-box with modern browsers, and with the magic of AJAX and DHTML, doesn't
even need a popup window.  XML is also still actively supported and is aimed at
users who wish to further customize the user-experience or provide a non-browser
based UploadMeter.  Both JSON and XML provide identical data; a formal XSL schema
can be seen at http://uploaddemo.beamartyr.net/demo/xml/meter/styles/xml/aum.xsd

=head1 BUILT-IN TYPES

Apache::UploadMeter comes pre-bundled with 2 DHTML-based graphical meters that
can be used as-is, or just as reference points for builing your own custom
meters.  Currently the 2 types can be selected by specifying I<JSON> or I<XML> in
the MeterType configuration directive.  Each of these will cause
Apache::UploadMeter to add relevant code to your upload form page.

=head1 CUSTOMIZATION

Additionally, I<NONE> can be specified, which will allow you to customize your
user-experience without using any of the built-in meters.  To use this, you

lib/Apache/UploadMeter.pm  view on Meta::CPAN


=item *
returned

This is a boolean (0 or 1) value used to help reduce race conditions when a new
upload is initiated.  If it is 0 or not defined, the server will cause the request
to block (for up to 15 seconds by default - overridable by setting
$Apache::UploadMeter::TIMEOUT) until the uploading content is detected by the
server and the meter's datastructure is initialized.  If it is 1, and the
I<meter_id> is not found on the server, a 404 error will be immediately returned.

=back

 view all matches for this distribution


Apache-UploadSvr

 view release on metacpan or  search on metacpan

lib/Apache/UploadSvr.pm  view on Meta::CPAN

    }
  } else {
    $what_we_did = "<HR>";
  }
  push @m, $what_we_did;
  push @m, $self->upload_form;
  push @m, qq{<HR><H4>Delete, Unzip, Publish, etc.</H4>};
  push @m, $file_listing;
  push @m, "<HR>";
  # push @m, $self->as_string;
  push @m, $cgi->endform;

lib/Apache/UploadSvr.pm  view on Meta::CPAN

  }
  $what_we_did .= qq{</TD></TR></TABLE>};
  $what_we_did;
}

sub upload_form {
  my($self) = @_;
  my $cgi = $self->{CGI};
  my $r = $self->{R};
  my($userref) = $self->{USERREF};

 view all matches for this distribution


Apache-Voodoo

 view release on metacpan or  search on metacpan

lib/Apache/Voodoo/Application/ConfigParser.pm  view on Meta::CPAN

	$conf{'base_package'} ||= $self->{'id'};

	# PCI says that sessions should expire after 15 minutes, this should be a sane default
	$conf{'session_timeout'} = (defined($conf{'session_timeout'}) && $conf{'session_timeout'} =~ /^\d+$/)?$conf{'session_timeout'}:900;

	$conf{'upload_size_max'} = (defined($conf{'upload_size_max'}) && $conf{'upload_size_max'} =~ /^\d+$/)?$conf{'upload_size_max'}:5242880;

	$conf{'cookie_name'} ||= uc($self->{'id'}). "_SID";

	$conf{'https_cookies'} = ($conf{'https_cookies'})?1:0;

 view all matches for this distribution


Apache-Watchdog-RunAway

 view release on metacpan or  search on metacpan

TODO  view on Meta::CPAN

* if it's polling the server every so often, it might as well generate
  a periodic report of what it finds.  How many processes, how long
  each has been running, how much memory, etc.

* add a regex for URLs not to be watched, since these can be lengthy
upload/download operations. Note that you have only 64 chars of the URI
provided by Apache::Scoreboard

* Eric has proposed to add a support for virtual hosts, based on
vhostrec->server_name

 view all matches for this distribution


Apache-WebDAV

 view release on metacpan or  search on metacpan

lib/Apache/WebDAV.pm  view on Meta::CPAN


            $okprops->addChild($prop);
        }

        # Add quota information.  This doesn't appear to be in the WebDAV
        # spec, but if it's not here, WebDrive won't allow any uploads.
        #
        # Update: I found it in a proposal here:
        #
        # http://www.greenbytes.de/tech/webdav/draft-ietf-webdav-quota-07.html
        # 

lib/Apache/WebDAV.pm  view on Meta::CPAN

 Goliath   (osx)
 Cadaver   (linux)
 Konqueror (linux)
 HTTP::DAV (perl)

The MacOSX Finder is also supported, assuming your Filesys::Virtual subclass is fully and correctly implemented.  Specifically, you can't expect the Finder to "PUT" a file in one nice step, rather, it takes multiple requests and it's difficult to pro...

In addition, depending on your Filesys::Virtual subclass, of course, this module passes most of the WebDAV Litmus tests (http://www.webdav.org/neon/litmus/) without errors or warnings.  Specifically:

 OPTIONS for DAV: header 
 PUT, GET with byte comparison 

 view all matches for this distribution


Apache-iNcom

 view release on metacpan or  search on metacpan

lib/Apache/iNcom.pm  view on Meta::CPAN

Apache::iNcom pages are HTML::Embperl pages with some extra variables
and functions available. See Apache::iNcom::Request(3) for details.
You may also which to consult the HTML::Embperl documentation for
syntax. Additionnaly, the normal $req_rec object in the page is an
instance of Apache::Request(3) so that you can handle multipart
upload.

=head1 DATABASE CONNECTIVITY

The database connection is opened once per request and shared by
all modules that must use it. Database access is mediated through

 view all matches for this distribution


Apache2-API

 view release on metacpan or  search on metacpan

lib/Apache2/API/Request.pm  view on Meta::CPAN

        return( $r->param( $name, @_ ) );
    }
    else
    {
        my $val = $r->param( $name );
        my $up = $r->upload( $name );
        # Return the Net:::API::REST::Request::Upload object if it is one
        return( $up ) if( Scalar::Util::blessed( $up ) );
        return( $val );
    }
}

lib/Apache2/API/Request.pm  view on Meta::CPAN

    my $r = Apache2::API::Request::Params->new( request => $self->request );
    # https://perl.apache.org/docs/1.0/guide/snippets.html#Reusing_Data_from_POST_request
    # my %params = $r->method eq 'POST' ? $r->content : $r->args;
    # Data are in pure utf8; not perl's internal, so it is up to us to decode them
    my( @params ) = $r->param;
    my( @uploads ) = $r->upload;
    my $upload_fields = {};
    # To make it easy to check if it exists
    if( scalar( @uploads ) )
    {
        @$upload_fields{ @uploads } = ( 1 ) x scalar( @uploads );
    }
    my $form = {};
    #my $io = IO::File->new( ">/tmp/form_data.txt" );
    #my $io2 = IO::File->new( ">/tmp/form_data_after_our_decoding.txt" );
    #my $raw = IO::File->new( ">/tmp/raw_form_data.txt" );

lib/Apache2/API/Request.pm  view on Meta::CPAN

        #$raw->print( "$k => " );
        #$io->print( "$k => " );
        my $name = utf8::is_utf8( $k ) ? $k : Encode::decode_utf8( $k );
        #$io2->print( "$name => " );
        $form->{ $name } = scalar( @values ) > 1 ? \@values : $values[0];
        if( CORE::exists( $upload_fields->{ $name } ) )
        {
            my $up = $r->upload( $name );
            if( !$up )
            {
                CORE::warn( "Error: could not get the Apache2::API::Params::Upload object for this upload field \"$name\".\n" );
                next;
            }
            else
            {
                $form->{ $name } = $up;

lib/Apache2/API/Request.pm  view on Meta::CPAN

    my $unparseed_path = $self->request->unparsed_uri;
    my $unparsed_uri = URI->new( $uri->scheme . '://' . $uri->host_port . $unparseed_path );
    return( $unparsed_uri );
}

sub uploads
{
    my $self = shift( @_ );
    my $r = Apache2::API::Request::Params->new( $self->request );
    my( @uploads ) = $r->upload;
    my $objs = $self->new_array;
    foreach my $name ( @uploads )
    {
        my $up = $r->upload( $name );
        if( !$up )
        {
            CORE::warn( "Error: could not get the Apache2::API::Params::Upload object for this upload field \"$name\".\n" );
        }
        else
        {
            CORE::push( @$objs, $up );
        }

lib/Apache2/API/Request.pm  view on Meta::CPAN

    # text/plain
    my $type = $req->type;
    my $raw = $req->unparsed_uri;

    # Apache2::API::Request::Params
    my $uploads = $req->uploads;
    my $uri = $req->uri;
    my $decoded = $req->url_decode( $url );
    my $encoded = $req->url_encode( $url );
    my $user = $req->user;
    my $agent = $req->user_agent;

lib/Apache2/API/Request.pm  view on Meta::CPAN

=head2 brigade_limit

    my $int = $req->brigade_limit;
    $req->brigade_limit( $int );

Get or set the brigade_limit for the current parser. This limit determines how many bytes of a file upload that the parser may spool into main memory. Uploads exceeding this limit are written directly to disk.

See also L</temp_dir>

=head2 call

lib/Apache2/API/Request.pm  view on Meta::CPAN

    <Directory /home/john/www>
        PerlOptions +GlobalRequest
        SetHandler modperl
        # package inheriting from Apache2::API
        PerlResponseHandler My::API
        # 2Mb upload limit
        PerlSetVar PAYLOAD_MAX_SIZE 2097152
    </Directory>

This is just an example and not a recommandation. Your mileage may vary.

lib/Apache2/API/Request.pm  view on Meta::CPAN


=head2 param

Provided a name, this returns its equivalent value, using L<Apache2::API::Request::Params/param>.

If C<$name> is an upload field, ie part of a multipart post data, it returns an L<Apache2::API::Request::Upload> object instead.

If a value is provided, this calls L<Apache2::API::Request::Param/param> providing it with the name ane value. This uses L<APR::Request::Param>.

=head2 params

lib/Apache2/API/Request.pm  view on Meta::CPAN

=head2 temp_dir

    my $dir = $req->temp_dir;
    $req->temp_dir( $dir );

Get or set the spool directory for uploads which exceed the configured brigade_limit.

=head2 the_request

    my $request = $req->the_request();
    my $old_request = $req->uri( $new_request );

lib/Apache2/API/Request.pm  view on Meta::CPAN


whereas C<< $req->unparsed_uri >> returns:

     /foo/bar/my_path_info?args=3

=head2 uploads

Returns an L<array object|Module::Generic::Array> of L<Apache2::API::Request::Upload> objects.

=head2 uri

 view all matches for this distribution


Apache2-ASP

 view release on metacpan or  search on metacpan

lib/Apache2/ASP/API.pm  view on Meta::CPAN

applications, allowing you to execute requests against ASP scripts and handlers
just as you would from a browser, but without the use of an HTTP server.

=head2 Why do I need this?

Consider the case where you want to upload hundreds of files into your website,
but you don't want to do it one-at-a-time.

The following snippet of code would do the trick:

  #!/usr/bin/perl -w

lib/Apache2/ASP/API.pm  view on Meta::CPAN

  
  foreach my $file ( @files )
  {
    # Assuming /handlers/MM is a subclass of Apache2::ASP::MediaManager:
    my $id = rand();
    my $res = $api->upload("/handlers/MM?mode=create&uploadID=$id", [
      filename => [ $file ]
    ]);
    
    die "Error on '$file': " . $res->as_string
      unless $res->is_success;
    
    print "'$file' uploaded successfully\n";
  }# end foreach()

If only logged-in users may upload files, simply log in before uploading anything:

  my $api = Apache2::ASP::API->new();
  
  my $res = $api->ua->post("/handlers/user.login", {
    user_email    => $email,

lib/Apache2/ASP/API.pm  view on Meta::CPAN

  unless( $api->session->{user} )
  {
    die "Invalid credentials";
  }# end unless()
  
  ... continue uploading files ...

Or...you could even subclass the API with your own:

  package MyApp::API;
  

lib/Apache2/ASP/API.pm  view on Meta::CPAN

    return 1;
  }# end login()
  
  1;# return true:

Then your uploader script could just do this:

  #!/usr/bin/perl -w
  
  use strict;
  use warnings 'all';

lib/Apache2/ASP/API.pm  view on Meta::CPAN

  
  my $api = MyApp::API->new();
  $api->login( 'test@test.com', 's3cr3t!' );
  
  # Upload all the files:
  $api->ua->upload("/handlers/MM?mode=create&uploadID=" . rand(), [
    filename => [ $_ ]
  ]) foreach @ARGV;

=head1 INTEGRATION TESTING

 view all matches for this distribution



Apache2-Controller

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

            the door with functional session checksum and
            correct documentation.

1.000.001   2008-12-20

            Put CPAN upload in the right directory.  Duh.

1.000.000   2008-12-20
            
            Session now saves only if status < 300, or if 
            notes->{a2c_session_force_save} is set.

 view all matches for this distribution


Apache2-Dispatch

 view release on metacpan or  search on metacpan

RELEASE  view on Meta::CPAN


  d. test whether we still 100% OK on systems with no LWP:

     % APACHE_TEST_PRETEND_NO_LWP=1 make test

2. once confident that the package is good, upload a release candidate
   to people.apache.org/~username and post 24 hour-ish candidate alert
   to the various lists

     o dev/perl.apache.org
     o modperl/perl.apache.org

RELEASE  view on Meta::CPAN

5. Announce the package

  a. post ... to the modperl, announce lists
  Subject: [ANNOUNCE] Apache-Dispatch 0.12
     include 
  - MD5 sig (as it comes from CPAN upload announce).
  - the latest Changes

6. Prepare for the next cycle

  a. increment version in lib/Apache/Dispatch.pm

 view all matches for this distribution


Apache2-FileManager

 view release on metacpan or  search on metacpan

FileManager.pm  view on Meta::CPAN


=head1 DESCRIPTION

The Apache2::FileManager module is a simple HTML file manager.  It provides
file manipulations such as cut, copy, paste, delete, rename, extract archive,
create directory, create file, edit file, and upload files.

Apache2::FileManager also has the ability to rsync the server htdocs tree to
another server with the click of a button.


FileManager.pm  view on Meta::CPAN


###############################################################################
# ----- Views --------------------------------------------------------------- #
###############################################################################

#after upload files - view
sub view_post_upload {
  r->print(q{
      <SCRIPT>
        window.opener.document.FileManager.submit();
        window.opener.focus();
        window.close();

FileManager.pm  view on Meta::CPAN

                        'resizable=yes,scrollbars=yes,width=650,height=650');
      var d = w.document.open();
      d.write(
        \"<HTML> <UL><B><U><FONT SIZE=+1>Help</FONT></U></B><BR><BR>\"+

        \"<LI><A NAME=upload><B>How do I upload files?</B></A><BR>\"+
        \"Click on the upload menu item. After the <I>Upload Files</I>\"+
        \"window opens, click the <I>Browse</I> button. \"+
        \"This will pop open another window showing files on your computer. \"+
        \"Select a file you want to upload. You can not upload directories. \"+
        \"If you want to upload a directory, archive it first into a \"+
        \"<I>zip</I> file or a tarball. You will then be able to extract \"+
        \"it on the server. You can upload up to 10 files at a time. \"+
        \"After selecting the files you want to upload, click the \"+
        \"<I>upload</I> button to transfer the files from your machine to \"+
        \"the server.<BR><BR>\"+

        \"<LI><A NAME=move><B>How do I copy or move files?</B></A><BR>\"+
        \"First click the check boxes next to the file names that you would \"+
        \"like to copy or paste. Next click the <I>copy</I> or <I>paste</I> \"+

FileManager.pm  view on Meta::CPAN

      } else{
        return true;
      }
    }

    function print_upload () {
      var w = window.open('','FileManagerUpload',
                          'scrollbars=yes,resizable=yes,width=500,height=440');
      var d = w.document.open();
      d.write(\"<HTML><BODY><CENTER><H1>Upload Files</H1>\"+
              \"<FORM NAME=UploadForm ACTION='".r->uri."' \"+

FileManager.pm  view on Meta::CPAN

        d.write(\"<INPUT TYPE=FILE SIZE=40 NAME=FILEMANAGER_file\"+i+\"><BR>\");
      }
      d.write(\"<INPUT TYPE=BUTTON VALUE='cancel' onclick='window.close();'>\"+
              \"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\"+
              \"<INPUT TYPE=SUBMIT NAME=FILEMANAGER_cmd\"+
              \"       VALUE=upload></CENTER></BODY></HTML>\");
      d.close();
      w.focus();
    }

    // make input check box form elements into an array ALL the time

FileManager.pm  view on Meta::CPAN

        return false;\"
        ><FONT COLOR=WHITE><B>new directory</B></FONT></A>",

    #Upload
    "<A HREF=# onclick=\"
        window.print_upload();
        return false;\"
        ><FONT COLOR=WHITE><B>upload<B></FONT></A>"
  );

  #Rsync
  my $rsync = "";
  if ($$o{'RSYNC_TO'}) {

FileManager.pm  view on Meta::CPAN

  }
  return undef;
}


sub cmd_upload {
  my $o = shift;
  my $arg1 = shift;
  my $count = 0;

  foreach my $i (1 .. 10) {

FileManager.pm  view on Meta::CPAN

    $filename =~ s/[^\w\ \d\.\-]//g;
    next if ($filename eq "");

    $count++;

    my $up = r->upload("FILEMANAGER_file$i");
    #next if not defined $up;

    #my $in_fh = $up->fh;
    #next if !defined $in_fh;

FileManager.pm  view on Meta::CPAN

    #  print $out_fh $_;
    #}
    #close($out_fh);

  }
  #$$o{MESSAGE} = "$count file(s) uploaded.";
  $$o{'view'} = "post_upload";
  return undef;
}


sub cmd_rename {

FileManager.pm  view on Meta::CPAN

                  dest => $$o{'RSYNC_TO'}    } )
      or warn "rsync failed\n";
    $$o{MESSAGE} = join("<BR>", @{ $obj->out }) if ($obj->out);
    $$o{MESSAGE} = join("<BR>", @{ $obj->err }) if ($obj->err);
  }
  $$o{'view'} = "post_upload";
  return undef;
}


sub cmd_mkdir {

 view all matches for this distribution


Apache2-PageKit

 view release on metacpan or  search on metacpan

lib/Apache2/PageKit.pm  view on Meta::CPAN

  $config->parse_xml;

  die "No config data for your server '$server' maybe you mistyped something?"
    unless exists $Apache2::PageKit::Config::server_attr->{$config_dir}->{$server};
    
  my $upload_tmp_dir = $config->get_global_attr('upload_tmp_dir');
  if ( $upload_tmp_dir && !-d $upload_tmp_dir ) {
    die "your upload_tmp_dir ($upload_tmp_dir) did not exists";
  }

  my $cache_dir = $config->get_global_attr('cache_dir');
  my $view_cache_dir = $cache_dir ? $cache_dir . '/pkit_cache' :
    $pkit_root . '/View/pkit_cache';

lib/Apache2/PageKit.pm  view on Meta::CPAN

  my $server = $rr->dir_config('PKIT_SERVER');
  die "Must specify PerlSetVar PKIT_SERVER in httpd.conf file" unless $server;
  my $config = $self->{config} = Apache2::PageKit::Config->new(config_dir => $config_dir,
                                                              server => $server);
  my $post_max = $self->{config}->get_global_attr('post_max') || 64_000_000;
  my $upload_tmp_dir = $self->{config}->get_global_attr('upload_tmp_dir');

  # the TEMP_DIR option is only avail since version 1.0 of libapreq
  # so we set it only on request.
  my @apr_params = ();
  push @apr_params, TEMP_DIR => $upload_tmp_dir if $upload_tmp_dir;
  my $request_class = $self->{config}->get_global_attr('request_class') || "Apache2::Request::PageKit";
  my $apr = $self->{apr} = $request_class->new($rr, POST_MAX => $post_max, @apr_params);
  my $model_base_class = $self->{config}->get_global_attr('model_base_class') || "MyPageKit::Common";

  $self->_check_gzip;

 view all matches for this distribution


Apache2-UploadProgress

 view release on metacpan or  search on metacpan

lib/Apache2/UploadProgress.pm  view on Meta::CPAN

received: %d
EOF

$TEMPLATES->{xml} = <<'EOF';
<?xml version="1.0" encoding="UTF-8"?>
%s<upload%s>
    <size>%d</size>
    <received>%d</received>
</upload>
EOF

$MIMES = {
    'application/x-json'    => sub { sprintf( $TEMPLATES->{json}, @_ ) },
    'application/x-yaml'    => sub { sprintf( $TEMPLATES->{yaml}, @_ ) },

lib/Apache2/UploadProgress.pm  view on Meta::CPAN

    my ( $class, $r ) = @_;

    return $r->headers_in->get('X-Upload-ID')
        || $r->headers_in->get('X-Progress-ID')                        # lighttpd compat
        || ( $r->unparsed_uri =~ m/\?([a-fA-F0-9]{32})$/ )[0]          # lighttpd compat
        || ( $r->unparsed_uri =~ m/(?:progress|upload)_id=([a-fA-F0-9]{32})/ )[0];
}

sub fetch_progress {
    my ( $class, $progress_id ) = @_;

lib/Apache2/UploadProgress.pm  view on Meta::CPAN


    my $progress_id = $class->progress_id($r)
      or return Apache2::Const::NOT_FOUND;
      
    my $progress = undef;
    my $tries    = 16; # wait a max of 4 seconds for the upload to start
    
    while ( $tries && !$progress ) {

        $progress = $class->fetch_progress($progress_id)
          or sleep(0.250);

lib/Apache2/UploadProgress.pm  view on Meta::CPAN


__END__

=head1 NAME

Apache2::UploadProgress - Track the progress and give realtime feedback of file uploads

=head1 SYNOPSIS

In Apache:

lib/Apache2/UploadProgress.pm  view on Meta::CPAN

 <div id="progress"></div>


=head1 DESCRIPTION

This module allows you to track the progress of a file upload in order
to provide a user with realtime updates on the progress of their file
upload.

The information that is provided by this module is very basic.  It just
includes the total size of the upload, and the current number of bytes that
have been received.  However, this information is sufficient to display lots of
information about the upload to the user.  At it's simplest, you can trigger a
popup window that will automatically refresh until the upload completes.
However, popups can be a problem sometimes, so it is also possible to embed a
progress monitor directly into the page using some JavaScript and AJAX calls.
Examples using both techniques are discussed below in the EXAMPLES section.


lib/Apache2/UploadProgress.pm  view on Meta::CPAN


=head2 Simple Popup Upload Monitor

The simplest way to add a progress monitor to your forms is to use the popup
technique.  This will launch a popup window with a progress monitor that will
automatically refresh until the upload is complete.  The popup will use the XML
method by default, and format the page using an included XSL stylesheet (which
can be customized to suit your needs).  If the browser does not support XML
transformations, then content negotiation will automatically fall back on a
basic HTML page.

lib/Apache2/UploadProgress.pm  view on Meta::CPAN

=over 4

=item handler

This handler should be run at the PerlPostReadRequestHandler stage,
and will detect whether we need to track the upload progress of the current
request.  There are 5 ways for the handler to determine if the upload progress
should be tracked:

=over 4

=item X-Upload-ID

lib/Apache2/UploadProgress.pm  view on Meta::CPAN

There is an incoming header called X-Progress-ID which contains the progess ID

=item Query contains ID

The query portion of the URL consists of just a 32 character hexadecimal
string (for example http://localhost/upload.cgi?1234567890abcdef1234567890abcdef)

=item Query contains progress_id

There is a query parameter in the query string called progress_id, and it
contains a 32 character hexadecimal number (for example
http://localhost/upload.cgi?progress_id=1234567890abcdef1234567890abcdef)

=item Query contains upload_id

There is a query parameter in the query string called upload_id, and it
contains a 32 character hexadecimal number (for example
http://localhost/upload.cgi?upload_id=1234567890abcdef1234567890abcdef)

=back

Note that you can not pass the progress_id as a hidden POST parameter,
since the Apache2::UploadProgress module never actually decodes the POST
request so it will not be able to determine what the ID is.  The reason
for this is that we are trying to track the rate at which the POST request
takes to upload, so we need that ID before we even start counting the incoming
POST request.  So the ID must be passed as a header, or as a simple query parameter,
as part of the action attribute of the form.

=item progress

When called, this handler will return the upload progress of the request
identified by the given ID.  The ID can be provided in exactly the same way
as in the handler method given above (Although is usually easiest to just provide
is as a query parameter called progress_id).

This handler can return the results in several different formats.  By default,

lib/Apache2/UploadProgress.pm  view on Meta::CPAN

=item Safari

The JavaScript for the embedded progress meter is currently failing in
Safari

=item Cancelled uploads

When a user cancels an upload, but leaves the page with the progress
meter active, the progress meter may continue to reload indefinately

=back

=head1 SEE ALSO

 view all matches for this distribution


Apache2-WebApp-Extra-Admin

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

Revision history for Perl module Apache2::WebApp::Extra::Admin

0.16
    - Migrated project SCM and code repository to Google Project hosting.
    - Updated POD and README artistic license URL in COPYRIGHT clause.
    - Changed each module version so that I can verify that the PAUSE packager/uploader script works as expected.
    - Updated license field in META.yml to fix 'License Unknown' issue on CPAN
    - Updated PREREQ_PM module versions in Makefile.PL
    - Updated module versions in META.yml requires field.

0.17

 view all matches for this distribution


Apache2-WebApp-Plugin-CGI

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

Revision history for Perl module Apache2::WebApp::Plugin::CGI

0.09
    - Migrated project SCM and code repository to Google Project hosting.
    - Updated POD and README artistic license URL in COPYRIGHT clause.
    - Changed each module version so that I can verify that the PAUSE packager/uploader script works as expected.
    - Updated license field in META.yml to fix 'License Unknown' issue on CPAN
    - Updated PREREQ_PM module versions in Makefile.PL
    - Updated module versions in META.yml requires field.

 view all matches for this distribution


Apache2-WebApp-Plugin-Cookie

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

Revision history for Perl module Apache2::WebApp::Plugin::Cookie

0.09
    - Migrated project SCM and code repository to Google Project hosting.
    - Updated POD and README artistic license URL in COPYRIGHT clause.
    - Changed each module version so that I can verify that the PAUSE packager/uploader script works as expected.
    - Updated license field in META.yml to fix 'License Unknown' issue on CPAN
    - Updated PREREQ_PM module versions in Makefile.PL
    - Updated module versions in META.yml requires field.

 view all matches for this distribution


( run in 3.140 seconds using v1.01-cache-2.11-cpan-b16cb0d3907 )