pegasus.lua icon indicating copy to clipboard operation
pegasus.lua copied to clipboard

support to file upload(plugin)

Open EvandroLG opened this issue 9 years ago • 3 comments

EvandroLG avatar May 20 '15 02:05 EvandroLG

Api: table_files = request.get_files()

zac23or avatar Jun 09 '15 16:06 zac23or

API:

  • content_type_filter = {"jpg", png"}
  • content_type_discover={ "file_type","file_extension"}
  • destination = "image/"
  • min_ body_size = 1048576
  • max_body_size = 1048576
  • file

EvandroLG avatar Jan 17 '16 14:01 EvandroLG

Here is a patch to the master branch which adds basic multi-part form parsing capability (and so file uploads too). It's not implemented as a plugin and, frankly, I have no idea how that would even be done without extreme breaking changes.

Unlike other parameters, files have more data than just their name and value, so they are stored in the post data as tables. The rest is as it were to maintain backwards-compatibility. Find in request:post().

I do not recommend using this in production. I'm certain malicious input is still capable of crashing it, and there's not even a max file or max content size. At least it exists, which is more than can be said for the file uploading plugin.

Looking for input on implementation, before this is polished and potentially pushed in.

midn1 avatar Mar 23 '23 17:03 midn1