-
☆ A M B ☆
- 24,524 Posts
Yep, works perfectly, even on IE! You can view the document’s configuration and the snippet; log in to
http://www.sottwell.com/manager as guest, password guestuser and view everything.
Preview issues solved, disabled it as indicated.
I experimented different mime types but are still getting two extra lines containing 3 blanks though... no idea where to search where these come from, checked the snippet, document, template.
No big deal for text files right now, but not very confident to start making binaries this way.
A thing of beauty is a joy forever ( John Keats)
Howdi!
To get rid of these extra lines I finally adopted the method proposed by doze, generate my flat file in the snippet and finish the snippet code with a
[tt]$modx->SendRedirect( ’./my/url/to/download/page?file=name’); [/tt]
So I now have a file as intended, no extra blanks anymore.
I do notice however that FF and IE open a new window before opening the download dialog... is there a way to prevent this?
TIA
A thing of beauty is a joy forever ( John Keats)
In your download.php script (file "./my/url/to/download/page" in your example) try changin:
header("Content-Disposition: attachment; filename=".$filename);
to:
header("Content-Disposition: attachment; filename=\"".basename($filename)."\"");
That fixes some issues, not sure if it will fix the new window though.. hmm..
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
Nope, still a new window... must be doing something wrong ’cause when I make a download from
http://www.muddydogpaws.com/notebook/file-download-snippet I don’t get a new window, just the download box.
I will investigate... stay tuned.
A thing of beauty is a joy forever ( John Keats)