[mod_python] BMP upload problems

Aaron Prillaman prillamana at cox.net
Fri Apr 16 01:10:44 EST 2004


In uploading a bmp file with the following setup, something is corrupting the data.

I have a very simple python script:
tst.py..........

from mod_python import util
datadir = '/Documents and Settings/owner/desktop/www/data/'

def upload(req,sfl):
    sdata = req.form['sfl'].file.read()
    ofl = open(datadir+"tst.bmp","w")
    ofl.write(sdata)
    return "ok"


and a simple form:
http://mollysgrave.no-ip.com:82/tst.html
tst.html............

<html>
<form action="/cgi-bin/tst.py/upload" method="post" enctype="multipart/form-data"><br>
file: <input type="file" name="sfl">
<input type="submit">
</form>
</html>

I upload http://mollysgrave.no-ip.com:82/brown1.bmp
and http://mollysgrave.no-ip.com:82/tst.bmp is the result.
I'm not really sure what the inconsistency is.  Just wondering if anyone has ideas.

Thanks,
Aaron Prillaman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.modpython.org/pipermail/mod_python/attachments/20040416/feb23432/attachment.html


More information about the Mod_python mailing list