Hi,

I'm trying to make a file upload routine in poet/mason. Before - with 
html::mason - I used the following CGI-based routines:

('upfile' is posted with form the user filled in)

my $query = $m->cgi_object;
my $fh = $query->upload('upfile');
my $filename = query->param('upfile');

# Write uploaded file to location on server with specified name
open (OUTFILE, ">/uploaddir/$filename");
binmode OUTFILE;
my $buffer;
while ( my $bytesread=read($fh,$buffer,1024) ) {
    print OUTFILE $buffer;
}
close OUTFILE;

In poet/mason this does not work anymore.

I have been able to figure out that with Plack::Request::Upload I can 
use $m->req->uploads->{upfile} to find out the following information 
about the upload:

$upload->size
$upload->path
$upload->content_type
$upload->basename

But how to proceed? How to actually upload the file? Can some kind soul 
provide an example how to do this? This would be much, much appreciated!

Kind regards,

Wil Peters.

------------------------------------------------------------------------------
Own the Future-Intel® Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to