agentzh / lua-resty-multipart-parser

Simple multipart data parser for OpenResty/Lua
38 stars 17 forks source link

Binary files do not work #4

Open vsguts opened 6 years ago

vsguts commented 6 years ago

When I try to upload binary file (jpg), I get error: failed to parse part: resty/multipart/parser.lua:58: bad argument #1 to 'find' (string expected, got nil).

When I try upload txt file, everything is ok.

weaponready commented 4 years ago

+1

agentzh commented 4 years ago

Try the latest OpenResty 1.15.8.2 version?

anguslee commented 4 years ago

Try setting client_body_buffer_size to some value greater than the size of your jpg file. It seems that ngx.req.get_body_data() cannot receive data beyond _client_body_buffersize. That's how I fixed the same error. @vsguts

Perhaps that's one thing @agentzh meant in his TODO section: Better error reporting. :)