Graham Dumpleton
grahamd at dscpl.com.au
Thu Apr 6 02:14:59 EDT 2006
Definitely missing the required blank line after the content disposition line in the second group. '------------ae0gL6ae0cH2KM7ae0cH2Ij5ei4ei4\r\nContent-Disposition: form-data; name="Filename"\r\n\r\nsample.txt\r\n------------ae0gL6ae0cH2KM7ae0cH2Ij5ei4ei4\r\nContent-Disposition: form-data; name="Filedata"; filename="sample.txt"\r\nContent-Type: application/octet-stream\r\n\r\nStart of Sample Text File Contents\r\nEnd of Sample Text File Contents\r\n\r\n------------ae0gL6ae0cH2KM7ae0cH2Ij5ei4ei4\r\nContent-Disposition: form-data; name="Upload"\r\nSubmit Query\r\n------------ae0gL6ae0cH2KM7ae0cH2Ij5ei4ei4' I can't find a simple reference right now to refer to which says it is required, but relevant RFCs are: http://rfc.sunsite.dk/rfc/rfc1521.html http://rfc.sunsite.dk/rfc/rfc1522.html http://rfc.sunsite.dk/rfc/rfc1867.html Just to see if it works, add a blank line at the beginning of your data in the second section before it gets packaged into the post. Graham Harold J. Ship wrote .. > > Attached output. > > LS0tLS0tLS0tLS0tYWUwZ0w2YWUwY0gyS003YWUwY0gySWo1ZWk0ZWk0DQpDb250ZW50LURp > c3Bv > c2l0aW9uOiBmb3JtLWRhdGE7IG5hbWU9IkZpbGVuYW1lIg0KDQpzYW1wbGUudHh0DQotLS0t > LS0t > LS0tLS1hZTBnTDZhZTBjSDJLTTdhZTBjSDJJajVlaTRlaTQNCkNvbnRlbnQtRGlzcG9zaXRp > b246 > IGZvcm0tZGF0YTsgbmFtZT0iRmlsZWRhdGEiOyBmaWxlbmFtZT0ic2FtcGxlLnR4dCINCkNv > bnRl > bnQtVHlwZTogYXBwbGljYXRpb24vb2N0ZXQtc3RyZWFtDQoNClN0YXJ0IG9mIFNhbXBsZSBU > ZXh0 > IEZpbGUgQ29udGVudHMNCkVuZCBvZiBTYW1wbGUgVGV4dCBGaWxlIENvbnRlbnRzDQoNCi0t > LS0t > LS0tLS0tLWFlMGdMNmFlMGNIMktNN2FlMGNIMklqNWVpNGVpNA0KQ29udGVudC1EaXNwb3Np > dGlv > bjogZm9ybS1kYXRhOyBuYW1lPSJVcGxvYWQiDQpTdWJtaXQgUXVlcnkNCi0tLS0tLS0tLS0t > LWFl > MGdMNmFlMGNIMktNN2FlMGNIMklqNWVpNGVpNA== > > > -----Original Message----- > From: Graham Dumpleton > Sent: Wednesday, April 05, 2006 11:57 PM > To: Harold J. Ship > Cc: Jim Gallacher; mod_python at modpython.org > Subject: Re: [mod_python] ValueError with Flash 8 > FileReference.upload(url) > > > If it isn't formatted per the standards for how multipart forms are > meant to be formatted, that it may be accepted on platform does not > matter as there are no guarantees it will be accepted on another. > > Anyway, to settle this, capture your post data again using that handler, > but change the handler to: > > from mod_python import apache > import base64 > > def handler(req): > > data = open("/some/path/post.dat", "wb") > data.write(base64.encodestring(req.read())) > data.close() > > req.content_type = 'text/plain' > req.write("Done") > > return apache.OK > > By encoding it as base64 before being sent, we know for sure that > nothing about how it was written to file or dealt with by any mail > software will stuff up CR LF sequences and we can see exactly what was > received. > > Graham
|