cgi binary upload

Max M maxm at
Wed Sep 18 15:31:30 EDT 2002

Robin Becker wrote:

> I know there's a lot of skilled people using python so I thought I'd ask
> how one can get an HTML page to do a proper binary upload using the 
> <input type=file> form tag. We want to do this for PDF documents, but it
> seems as though IE/Mozilla/Netscape clients insist on putting 
> Content-Type: data/pdf
> or similar headers into the multi part file section and the files have
> their line endings corrupted.

That should not be a problem. I have not heard of the cgi module having 
those kind of problems at least.

> On the receiving side using we are certainly seeing some
> filetypes OK eg zip files, but surely we should be able to fix this more
> reliably.

cgi usually is reliable.

> I should note that experimentally renaming the file as
> xxx.xpdf made no difference as the mime type was being correctly
> determined by the browser. 

I don't think your problem is with Python. You are probably having a 
problem somewhere else in the chain.

At least we should see some code, or you need to be more specific.

regards Max M

More information about the Python-list mailing list