Newsletter::Html::Upload - Fileupload!


Newsletter documentation Contained in the Newsletter distribution.

Index


Code Index:

NAME

Top

Newsletter::Html::Upload - Fileupload!

VERSION

Top

Version 0.01

SYNOPSIS

Top

Attchments and embedded files inside of the mails

Perhaps a little code snippet.

    use Newsletter::Html::Upload;

    my $foo = Newsletter::Html::Upload->new();
    ...

EXPORT

Top

A list of functions that can be exported. You can delete this section if you don't export anything, such as for a purely object-oriented module.

FUNCTIONS

Top

AUTHOR

Top

Dominik Hochreiter, <dominik at soft.uni-linz.ac.at>

BUGS

Top

Please report any bugs or feature requests to bug-newsletter-html-upload at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Newsletter. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc Newsletter

You can also look for information at:

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/Newsletter

* CPAN Ratings

http://cpanratings.perl.org/d/Newsletter

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Newsletter

* Search CPAN

http://search.cpan.org/dist/Newsletter

ACKNOWLEDGEMENTS

Top

COPYRIGHT & LICENSE

Top


Newsletter documentation Contained in the Newsletter distribution.
package Newsletter::Html::Upload;

use warnings;

use strict;

sub fileUpload {
        my ($self, $cgiParamName ) = @_;

	my $file = $self->{'cgi'}->param( $cgiParamName );

	return "No File !" if(!$file);

	my $saveFile = $file;
	$saveFile =~s/^.*\\([\w\d_\- \(\)]+\.[\w]+)$/$1/g;
        $saveFile =~s/ /_/g;

	my $savePath = $self->{'uploadPath'}.'/'.$saveFile;

	open (FILE, '>'.$savePath) or die "Error processing file: $savePath, $!\n";
        binmode FILE;
	
        $self->_lowRead( \$file, \*FILE );

        close FILE;

	# return file+path on server
	return $saveFile;
}


sub _lowRead {
        my ($self, $file, $FILE_HANLDE) = @_;
        my $data;
        while(read $$file, $data, 32768) { #1 #1024
                print $FILE_HANLDE $data;
        }
}



our $VERSION = '0.01';

1; # End of Newsletter::Html::Upload