Created
March 3, 2010 07:52
-
-
Save fujiwara/320421 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use CGI; | |
use CGI::Carp qw/ fatalsToBrowser /; | |
use Digest::MD5 qw( md5_hex ); | |
my $q = CGI->new(); | |
my $imagedata = $q->param("imagedata"); | |
my $filename = "image/" . md5_hex(time() . $$ . rand()) . ".png"; | |
open my $fh, ">", $filename or die $!; | |
print $fh $imagedata; | |
close $fh; | |
print "Content-Type: text/plain; charset=utf-8\n"; | |
print "\n"; | |
printf "http://%s/%s\n", | |
($ENV{HTTP_HOST} || $ENV{SERVER_NAME}), | |
$filename; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment