[mod_python] Distinguishing uploaded files from POST form data

Michael M tactics40 at gmail.com
Sun Dec 9 01:42:20 EST 2007


Hello,

I'm using mod_python for a project of mine. It's working very nicely, save a
few quirks.

My question is how do you distinguish between regular form POST data and
uploaded files? In other words, I want to be able to take a FieldStorage
object and split it into something analogous to PHP's $_POST and $_FILES.
FieldStorage is a sloppy class which is tied way to closely to the
underlying implementation of HTTP. I was to abstract it so I can more easily
unittest my system (because mod_python absolutely hates being imported
outside of Apache). However, as far as I have been able to figure out,
there's no clear way to tell which is which. I can also imagine that maybe
PHP does a little black magic and the actual difference between uploaded
files and post data is fuzzier than Zend would have us all believe. If such
is the case, what would my best strategy be to try and make a good guess as
to when data is constitutes an uploaded file?

Any help would be spectacular.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20071209/d04f5ff3/attachment.html


More information about the Mod_python mailing list