perl - How can I abort a Catalyst upload based on Content-Length or MIME-Type? -
I tried to use parse_on_demand as I have shown:
However, Do not stop uploading; I'm testing it just by creating an action that dies immediately, though the browser starts uploading a large file I chose before reaching my action:
Sub Upload: Local {My ($ self, $ c) = @_; Die; #What I would like to do: # if ($ c-> req-> header ('content-length')> $ some_limit) ## "The upload is too big"; #} # ... check filename extension and mime-type ...}
Is the correct method for upload verification?
Handles the catalyst upload before sending it for your operation before you in the process of handling the request It will need to be intercepted and it means that a plugin, I doubt it.
I am not an expert in uploading with catalyst, but there can be something that already does, so it is worth searching on cpan ... but if I do not see the plugin How to get a position on the current upload, you can kill the upload in the same way.
JK
Comments
Post a Comment