[mod_python] sendfile problems with IE

Mark Norley m_norley_newsgroups at yahoo.co.uk
Tue Oct 31 09:45:12 EST 2006


Hello

Hope this list can save me again ;-)
This bit of code works fine in Firefox and Netscape but IE doesn't like it:

def handler(req):
    req.content_type = "application/vnd.ms-excel"
    req.set_content_length(os.path.getsize(ROOT+'\\taggedhits.xls'))
    req.headers_out["Content-Disposition"] = "attachment;
filename=taggedhits.xls"
    req.sendfile(ROOT+"\\taggedhits.xls")
    return apache.OK

With IE the File Download dialogue looks strange. IE thinks the filename is
filehandler_py rather than taggedhits.xls:

Name: filehandler_py
Type: Microsoft Excel Worksheet, 13.5 KB
From: 'mysite'

filehandler.py is the name of the script for starters, not the file I want
to download, and why has IE swapped the dot for an underscore?

On pressing Save I get:
Internet Explorer cannot download filehandler.py from 'mysite'.
Internet Explorer was not able to open this internet site. The requested
site is either unavailable or cannot be found. Please try again later.

Does anyone know what I need to do for IE to recognise the file? I'm
thinking I'm missing a header field or something.  

Cheers
Mark

Win XP SP2
Python 2.4.2
Apache 2.2.2
Mod_python 3.2.10
Firefox 1.5.0.7
Netscape 7.2
IE 6

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.13.20/508 - Release Date: 31/10/06
 

Send instant messages to your online friends http://uk.messenger.yahoo.com 


More information about the Mod_python mailing list