NAME
Apache2::ASP::MediaManager - Instant file management for Apache2::ASP applications
SYNOPSIS
First, add the following to your httpd.conf file:
PerlSetEnv APACHE2_MEDIA_MANAGER_UPLOAD_ROOT /usr/local/dstack/MEDIA
# Configuration for MediaManager:
RedirectMatch ^/media/(.*) /handlers/MyMediaManager?file=$1
Then, in your /handlers directory for your Apache2::ASP website, make a new file named "MyMediaManager.pm":
package MyMediaManager;
use strict;
use base 'Apache2::ASP::MediaManager';
#==============================================================================
sub upload_end
{
my ($s, $Session, $Request, $Response, $Server, $Application, $Upload) = @_;
shift(@_);
my $info = $s->SUPER::upload_end( @_ );
# Do whatever we want to the new file on disk:
# recombobulate( $info->{new_file} );
# Store a friendly message:
$Session->{message} = "Your upload was successful";
# Redirect the user to your "Thank you" page:
$Response->Redirect( "/upload_completed.asp?file=$info->{link_to_file}" );
}# end upload_end()
1;# return true:
Now, when you want to upload files, just point the upload form to /handlers/MyMediaManager, like so:
<html>
...
<form method="POST" enctype="multipart/form-data" action="/handlers/MyMediaManager">
<input type="file" name="filename">
<input type="submit" value="Click Here to Upload">
</form>
...
</html>
DESCRIPTION
Almost any web applications will eventually require some kind of file-upload functionality.
Apache2::ASP aims to deliver this right out of the box. Since all the file-upload work is already done, all you need to do is subclass Apache2::ASP::MediaManager
and go from there (as shown in the synopsis above).
AUTHOR
John Drago mailto:jdrago_999@yahoo.com
COPYRIGHT AND LICENSE
Copyright 2007 John Drago, All rights reserved.
This software is free software. It may be used and distributed under the same terms as Perl itself.