[Dancer-users] Testing image upload

Flavio Poletti polettix at gmail.com
Wed Nov 9 18:40:33 CET 2011


On Tue, Nov 8, 2011 at 12:22 PM, Stephen Fenwick-Paul
<stephen at activeg.org> wrote:
> Hi,
>
> I've can successfully upload an image from a browser but using the same
> route in my test suite with this:
>
> $response = dancer_response( POST => '/auth/location/1011/image',
>                                 {
>                                     params => {},
>                                     files => [{name => 'file', filename =>
>  "test.png"}]
>                                  },
>
>                              );
> (taken from
> the http://search.cpan.org/~xsawyerx/Dancer-1.3080/lib/Dancer/Test.pm)
> I get the error:
> "libpng error: PNG file corrupted by ASCII conversion"
> so I'm guessing the test is missing something that the browser is doing? Any
> ideas?

I suppose that you get that error when you try to open the image with
some image viewer. Did you try to look at the file with a text editor?

Cheers,

   Flavio.


More information about the Dancer-users mailing list