Download Unsuccessful in Mobile Browser (Android) when using cfheader and cfcontent in Coldfusion

When I run the code below from the desktop browser, there is no problem.

However, when I try to use it in both Android Chrome and the default Android browser, I always get the message โ€œDownload failedโ€.

code:

<cfsetting enablecfoutputonly="yes"> <cfcontent type="text/calendar" reset="Yes"> <cfheader name="Content-Disposition" value='inline; filename="newAppointment.ics"'> <cfoutput>BEGIN:VCALENDAR PRODID:-//Some organization//some application//EN VERSION:2.0 METHOD:REQUEST BEGIN:VEVENT UID: 20120925T072912Z-140@http ://localhost/www/ CREATED:20140925T072912Z DTSTAMP:20140922T090500Z DTSTART:20140922T090500Z DTEND:20140922T100500Z DESCRIPTION:Please attend this sample meeting SUMMARY:Invitation to attend training LOCATION:Earth ATTENDEE;RSVP=TRUE:mailto: periklis@example.com ORGANIZER; CN=periklis@example.com :mailto: periklis@example.com LAST-MODIFIED:20140925T072912Z PRIORITY:5 SEQUENCE:0 STATUS:CONFIRMED TRANSP:TRANSPARENT END:VEVENT END:VCALENDAR</cfoutput> <cfsetting enablecfoutputonly="no"> 

I tried using "text / calendar" and "application / octet-stream" for the content type, as well as "inline" and "attachments" to host the content. I also tried the file name with quotes and without them ... all to no avail.

We are running Coldfusion 10 on the IIS server, and we have added this configuration to the server so that we can download the .ics file directly from the server. However, we want to generate a one-time file with dynamic use and maintain it for the user.

IIS server setup:

 <configuration> <system.webServer> <staticContent> <remove fileExtension=".ics" /> <mimeMap fileExtension=".ics" mimeType="application/octet-stream" /> </staticContent> </system.webServer> </configuration> 

Using Chrome's remote debugging, I see that this happens as the Response header from the code above. (Note: I see that many people put cfheader first, then cfcontent ... but if I follow this order, then the content is not transferred, so I put cfcontent first.)

Answer Header:

 HTTP/1.1 200 OK Connection: close Date: Fri, 05 Sep 2014 21:31:31 GMT Server: Microsoft-IIS/6.0 P3P: CP='NOI DSP COR LAW NID CUR ADMa OUR DELa IND PHY ONL UNI PUR COM NAV STA' Vary: Accept-Encoding,User-Agent Content-Disposition: inline; filename="newAppointment.ics" Content-Type: text/calendar;charset=UTF-8 

I surfed the internet and the closest thing I found is another stackoverflow question with some suggestions but no accepted answer. Also ... as a new user, I cannot comment on him to find out if an answer is found.

download cfheader cfcontent for mobile browsers unsuccessfully

I tried to give so many details that I can think of. Let me know if help will be more helpful in resolving this oddity.

As always, any help would be greatly appreciated.

+6
source share
1 answer

Try changing this from "inline" to "attachment"

 <cfheader name="Content-Disposition" value='inline; filename="newAppointment.ics"'> <cfheader name="Content-Disposition" value="attachment; filename=""newAppointment.ics"""> 
0
source

Source: https://habr.com/ru/post/974906/


All Articles