Новости | FAQ | Авторы | Документация | В действии | Библиотека |
Инструменты | Полезные ссылки | Хостинги | Скачать | Примеры | Форум |
Sanja v.2 06.11.2010 20:23 / 06.11.2010 20:26
до 3.4 обновился, не полегчало.#!/usr/bin/perl -w use strict; use CGI; use CGI::Carp qw ( fatalsToBrowser ); use MIME::Base64; use Mail::Send; $CGI::POST_MAX = 1024 * 19000; my $query = new CGI; my $iurl = $query->param("imageUrl"); my $data = $query->param("data"); my $type = $query->param("type"); # "data:image/png;base64," = 22 bytes ; $data = substr($data, 22); $data = decode_base64( $data ); my $temp = "/xxxxx/public_html/cgi-bin/screenshot/temp." . $type ; open ( UPLOADFILE, ">" . $temp ) or die "$!"; binmode UPLOADFILE; print UPLOADFILE $data ; close UPLOADFILE; undef $data ; use MIME::Lite; my $msg = MIME::Lite->new( From => 'xxxxx', To => 'yyyyyyyyy@twitpic.com', Subject => ${iurl} , Type => 'multipart/mixed', ); $msg->attach( Type => 'TEXT', Data => ${iurl} , ); $msg->attach( Type => 'image/png', Path => 'temp.png', Filename => ${temp} , ); $msg->send; print $query->header ( ); print <<end_html; $iurl end_html unlink( $temp ); #EOFИ вот результат http://www.twitpic.com/34h9rf/full