How to handle POST upload files

Jeremy James jbj at
Mon Sep 3 13:13:29 UTC 2007

Galtsev Igor wrote:
> Please provide me - How to handle POST upload files from PerlBal
> plugin?
> I create new my own PerlBal plugin and I need to upload from POST
> request any data files and save it to server.
> Sorry, but I dont see any examples - how to do this?

This isn't something that is very easy to do with perlbal - you'd be
better off proxying the request to another server that can decode the
form data, probably with your favourite web toolkit (PHP, Rails, Django
etc). Perlbal is helpful in buffering POSTs above a certain size to
disk, which means your backend process doesn't have to be tied up just
reading data from slow uploads.

We do some amount of handling POSTs from clients, but handle them
outside of perlbal - we'd like to be able to handle them as they are
being uploaded, but the result often depends on data provided in the
form after the file data, eg. the filename to save the file to disk as.

I may soon write a plugin that decodes and saves any uploaded files to
disk, sending the request on to the backend server as normal, but with
file contents replaced in the request to a normal field containing a
local location on the disk. Is this the sort of behaviour you had in
mind? Obviously this is only practical where PB is on the same machine
as the backend.

PUTs are a different matter - perlbal will handle these directly in the
web_server role (and handle chunked PUTs nicely too!), although you will
unfortunately need to provide your own client software to upload the file.


More information about the perlbal mailing list