Mobile browser cfheader cfcontent failed to download

I am serving the .ePub file for download without displaying the url to the client. The code below works in any browser on a PC / Mac, but it doesn’t work in mobile browsers, at least on Android, which I currently have for testing. Each time I get the message "download unsuccessful". Any ideas ???

code:

<cfheader name="content-disposition" value="attachment;filename=#authStuff.lastname#-#theTitle#.ePub" /><cfcontent type="application/unknown" file="d:\home\sample.net\bookSource\#book.ePub#"> 
+1
source share
2 answers

all the examples I saw and used ave the space between the attachments; and file name so you can try:

 <cfheader name="content-disposition" value="attachment; filename=#authStuff.lastname#-#theTitle#.ePub" /> 

Also, use FireBug or Fiddler to make sure the header goes unchanged. Can you imagine desktop browsers to keep the correct file name?

EDIT: I just tried my ios code with a pdf file and it happily swallowed the PDF file, so the space can be a red herring, however it makes me think it is probably worth trying the code below to try to figure out if ePub or heading:

 <cfheader name="content-disposition" value="attachment;filename=something.pdf" /> <cfcontent type="application/unknown" file="#expandpath('something.pdf')#"> 
0
source

Try the following two code changes:

1) Wrap the content file name in quotation marks (using double quotation marks to avoid them, or #Chr (34) # so that they do not get confused with your value attribute quotes).

2) Use application / octet-stream as the content type (indeed, this application is / epub + zip, but Android does not seem to recognize it).

This is similar to working with Android 2.3.5 at least.

 <cfheader name="content-disposition" value="attachment; filename=#Chr(34)##authStuff.lastname#-#theTitle#.ePub##Chr(34)#"> <cfcontent type="application/octet-stream" file="d:\home\sample.net\bookSource\#book.ePub#"> 
0
source

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


All Articles