[Catalyst] Handling uploaded file for multipart request

Chakkit Ngamsom chakkit at ibiz.co.th
Sat Apr 19 11:24:35 GMT 2014


Hi Hailin,

My bad, the problem came from my custom prepare_headers that overrides $c->req->upload.

======
sub prepare_headers {
    my $c = shift;
    $c->maybe::next::method( @_ );

    # override request method by method parameter. allowed only when POST
    if ($c->req->method eq 'POST') {
        my $method = $c->req->params->{method} || '';
        $c->req->method($method) if lc($method) =~ /get|post|put|delete/; # <- mistake here should be PUT/DELETE only
    }
}
======

Regards,
Chakkit

-----------------------------------------------------------------------
iBiz Network Co., Ltd.
189/109 Soi Krungthep Kretha 7, Huamark, Bangkapi,
Bangkok 10240 Thailand Tel: 0-2184-6935, Fax: 02-184-6938
Website: http://www.ibiz.co.th, http://www.sitepackage.com

-----Original Message-----
From: Hailin Hu [mailto:i at h2l.name] 
Sent: Friday, April 18, 2014 11:23 PM
To: The elegant MVC web framework
Subject: Re: [Catalyst] Handling uploaded file for multipart request

You can't get the content directly. The file uploaded is saved in the tmp directory. See doc below:

http://search.cpan.org/~jjnapiork/Catalyst-Runtime-5.90061/lib/Catalyst/Request/Upload.pm

On Fri, Apr 18, 2014 at 5:45 PM, Chakkit Ngamsom <chakkit at ibiz.co.th> wrote:
> Hi All,
>
> I’ve trouble when handling uploaded file from my angularjs app + 
> ngflow.js
>
> The ngflow.js script sends multipart as default.
>
>
>
> Please take a look dump data of $c->req here:
>
> http://dev.ibiz.so/tmp/catalyst_handling_multipart_upload.txt
>
>
>
> As the dump log, I think the file was uploaded just fine but I just do 
> not know how to do with it.
>
> $c->req->upload, $c->req->body_data seems useless.
>
>
>
> I’m developing on Windows 8.1, Strawberry Perl 5.16.2 and Catalyst 5.90062.
>
> Using Apache as reverse proxy to a stock startup script.
>
>
>
> Regards,
>
> Chakkit
>
>
>
> ----------------------------------------------------------------------
> -
>
> iBiz Network Co., Ltd.
>
> 189/109 Soi Krungthep Kretha 7, Huamark, Bangkapi,
>
> Bangkok 10240 Thailand Tel: 0-2184-6935, Fax: 02-184-6938
>
> Website: http://www.ibiz.co.th, http://www.sitepackage.com
>
>
>
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: 
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>

_______________________________________________
List: Catalyst at lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/




More information about the Catalyst mailing list