Created
October 4, 2010 08:44
-
-
Save soh335/609400 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
use strict; | |
use warnings; | |
use Plack::Request; | |
use Data::Dumper; | |
use Path::Class qw/file/; | |
use File::Copy; | |
use Cwd; | |
return sub { | |
my $env = shift; | |
my $req = Plack::Request->new( $env ); | |
my $file = $req->uploads->{image}; | |
if ($file) { | |
my $tempfile = Path::Class::File->new($file->{tempname}); | |
my $movepath = File::Spec->catfile(getcwd, 'tmp',$file->{filename}); | |
File::Copy::move($tempfile->stringify, $movepath); | |
} | |
return [ | |
200, | |
['Content-Type' => 'text/plain'], | |
['OK'], | |
]; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment