Andrew, clear your IE cache and try downloading the file again, or rename the file and then try downloading it. IE < 9.0 will use the cache control headers, so the file will be cached if you don't use the attachment keyword. Look at line ~300 in the globals.py
On Tuesday, August 27, 2013 3:38:40 PM UTC-7, Andrew Buchan wrote: > > OK, I added the following MIME type as suggested by Derek > > application/vnd.ms-excel.sheet.macroEnabled.12 > > to gluon.py, which results in the file being opened/saved as xlsm, so it > seems that is the correct one to use (gluon.py did have an entry for xlsm, > but not the right one) > > However...the workbook will not open with Excel telling me it contains > invalid content, and this is true regardless of whether I open or save the > file....BUT it works fine if I append "?attachment" to the URL... > > So we have the correct MIME type to update gluon.py with, and I'm tempted > to put down the need for the "?attachment" work-around as an IE8 problem as > it works fine in IE9... > > Thanks for all your help guys! > > > > On Tue, Aug 27, 2013 at 11:01 PM, Niphlod <[email protected] > <javascript:>>wrote: > >> open gluon/contenttype.py . It's pretty much self-explanatory, but if you >> don't know the correct mime-type, its not going to be useful. BTW, if you >> find a mime-type that works out, tell us, we'll definitely include that. >> >> >> On Tuesday, August 27, 2013 10:40:38 PM UTC+2, Andrew Buchan wrote: >> >>> Sorry, was that request for me? My developments are all internal, not >>> www so I've got no link to send... >>> >>> In terms of getting an immediate/temporary fix, how would I go about >>> adding that mime/content type to the rocket server my web2py app runs on? >>> >>> >>> >>> >>> On Mon, Aug 26, 2013 at 7:12 PM, Niphlod <[email protected]> wrote: >>> >>>> rotfl.... we miss a contenttype for xslm, but I can't find nowhere what >>>> is supposed to be the correct one. Can you point me to a link to an xslm >>>> file that it's working in IE8 ? >>>> >>>> >>>> On Monday, August 26, 2013 7:13:06 PM UTC+2, Andrew Buchan wrote: >>>> >>>>> I tried adding "?attachment", and I get a Save As dialog >>>>> box......trying to save it as a xlsx file!! I'm just baffled by how >>>>> something so basic can go so wrong... >>>>> I can download xlsm files fine from other sites, using IE8, so it has >>>>> to be something in the Rocket or web2py. >>>>> >>>>> Thanks for your help so far, just not sure where to go from now... >>>>> >>>>> >>>>> >>>>> >>>>> On Mon, Aug 26, 2013 at 4:48 PM, Niphlod <[email protected]> wrote: >>>>> >>>>>> uhm. ok. if you don't know what a content-type is, please don't >>>>>> fiddle with it. >>>>>> It may be that ie8 wants to autoopen the file instead of saving it >>>>>> like all the other browsers. The solution to force a "save as" dialog is >>>>>> quite simple: just add *?attachment *to the generated URL. >>>>>> >>>>>> >>>>>> On Monday, August 26, 2013 3:26:13 PM UTC+2, Andrew Buchan wrote: >>>>>> >>>>>>> Hi Niphlod, >>>>>>> >>>>>>> If I save file as xlsb I get an "invalid request" upon clicking on >>>>>>> the link... Seems the browser is trying to open the files whereas I >>>>>>> want it >>>>>>> to download. >>>>>>> >>>>>>> As for content-type and modifying >>>>>>> default.py/download(******)<http://default.py/download()> function >>>>>>> accordingly - can you provide an example of what alterations I should >>>>>>> make. >>>>>>> I can vaguely guess at what content type is all about, but have no >>>>>>> idea why it's required and why we should have to set it?? I just want >>>>>>> to >>>>>>> provide a link so the user can download a file is all... >>>>>>> >>>>>>> Thanks. >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Mon, Aug 26, 2013 at 1:21 PM, Niphlod <[email protected]> wrote: >>>>>>> >>>>>>>> content-type if not provided is guessed by gluon/contenttype.py. >>>>>>>> for xslx is 'application/vnd.**openxmlfor****mats-officedocument.** >>>>>>>> spreadshee****tml.sheet' >>>>>>>> >>>>>>>> If you need a different content-type, alter the >>>>>>>> default.py/download() function accordingly.... >>>>>>>> >>>>>>>> >>>>>>>> On Monday, August 26, 2013 2:13:58 PM UTC+2, Tim Richardson wrote: >>>>>>>>> >>>>>>>>> As a workaround, try saving the file as .xlsb and see what happens. >>>>>>>>> >>>>>>>>> On Monday, 26 August 2013 21:06:33 UTC+10, Andrew Buchan wrote: >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> I'm having a strange issue with a static file download. In the >>>>>>>>>> static folder I have a file with an xlsm extension, which I want >>>>>>>>>> users to >>>>>>>>>> be able to download via a hyperlink, which is created in the >>>>>>>>>> controller >>>>>>>>>> like so: >>>>>>>>>> >>>>>>>>>> report_file_name = "DESIGN_SPEND_VS_ESTIMATE.**xlsm******" >>>>>>>>>> ... >>>>>>>>>> DIV(P(A('Download report: %s' % report_file_name, >>>>>>>>>> _href=URL(r=request,c='static/******** >>>>>>>>>> downloads',f=report_file_name)********))), >>>>>>>>>> ... >>>>>>>>>> >>>>>>>>>> This creates a download link which works fine in Google chrome, >>>>>>>>>> Fine in IE9, but not in IE8, where it tries to download the file >>>>>>>>>> with a >>>>>>>>>> .xlsx extension, which Excel cannot open, so it looks like I'm >>>>>>>>>> serving a >>>>>>>>>> corrupt file, which I'm not. >>>>>>>>>> >>>>>>>>>> I've read up on this and aside from the really useful advice of >>>>>>>>>> telling me not to use IE8 (the default browser in my client's, the >>>>>>>>>> only >>>>>>>>>> pointer I get is that it may be to do with MIME type sniffing in IE, >>>>>>>>>> and >>>>>>>>>> that I need to change .htaccess settings on the server, which is >>>>>>>>>> equally >>>>>>>>>> useless to me as I might not always be in control of the server. As >>>>>>>>>> it >>>>>>>>>> turns out, this app runs on rocket on Windows, and there's nothing >>>>>>>>>> in the >>>>>>>>>> rocket docs about mime types, and I don't know if setting a >>>>>>>>>> .htaccess would >>>>>>>>>> even work on Windows. >>>>>>>>>> >>>>>>>>>> Any thoughts? >>>>>>>>>> >>>>>>>>> -- >>>>>>>> >>>>>>>> --- >>>>>>>> You received this message because you are subscribed to a topic in >>>>>>>> the Google Groups "web2py-users" group. >>>>>>>> To unsubscribe from this topic, visit https://groups.google.com/d/* >>>>>>>> *to****pic/web2py/uENzWdeuy2c/**unsubsc****ribe<https://groups.google.com/d/topic/web2py/uENzWdeuy2c/unsubscribe> >>>>>>>> . >>>>>>>> To unsubscribe from this group and all its topics, send an email >>>>>>>> to web2py+un...@**googlegroups.com. >>>>>>>> >>>>>>>> For more options, visit https://groups.google.com/**grou**** >>>>>>>> ps/opt_out <https://groups.google.com/groups/opt_out>. >>>>>>>> >>>>>>> >>>>>>> -- >>>>>> >>>>>> --- >>>>>> You received this message because you are subscribed to a topic in >>>>>> the Google Groups "web2py-users" group. >>>>>> To unsubscribe from this topic, visit https://groups.google.com/d/** >>>>>> to**pic/web2py/uENzWdeuy2c/**unsubsc**ribe<https://groups.google.com/d/topic/web2py/uENzWdeuy2c/unsubscribe> >>>>>> . >>>>>> To unsubscribe from this group and all its topics, send an email to >>>>>> web2py+un...@**googlegroups.com. >>>>>> For more options, visit >>>>>> https://groups.google.com/**grou**ps/opt_out<https://groups.google.com/groups/opt_out> >>>>>> . >>>>>> >>>>> >>>>> -- >>>> >>>> --- >>>> You received this message because you are subscribed to a topic in the >>>> Google Groups "web2py-users" group. >>>> To unsubscribe from this topic, visit https://groups.google.com/d/** >>>> topic/web2py/uENzWdeuy2c/**unsubscribe<https://groups.google.com/d/topic/web2py/uENzWdeuy2c/unsubscribe> >>>> . >>>> To unsubscribe from this group and all its topics, send an email to >>>> web2py+un...@**googlegroups.com. >>>> For more options, visit >>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >>>> . >>>> >>> >>> -- >> >> --- >> You received this message because you are subscribed to a topic in the >> Google Groups "web2py-users" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/web2py/uENzWdeuy2c/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected] <javascript:>. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

