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() 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] > <javascript:>>wrote: > >> content-type if not provided is guessed by gluon/contenttype.py. >> for xslx is >> 'application/vnd.openxmlformats-officedocument.spreadsheetml.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/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.

