-
- 898 Posts
Hey ruce,
Do you have PHx installed? If so, try turning it off to see if that makes a difference.
-
- 898 Posts
well it needs to be uncached.
you said [[!FileDownloadPE!]] didnt work
but does
[!FileDownloadPE!]
-
- 6 Posts
Changing the snippet call from [[!FileDownloadPE!]] to [!FileDownloadPE!] gives me the parse error message quoted above directly in my site...
Hhm, now that I come to think of: Maybe it is a problem that my site is not on my domains root, but in a subdirectory, and thus there is a "mod_rewrite" active on my server. As you can easily guess, it was not me who set whole thing up -- neither the MODx installation nor the server configuration. My "job" is only to make the contents, so unfortunately I do not really have a clue about these things. But I still hope (and pray) that I can get this solved myself (with a little help from you or others, of course)...
Thanks again, your help is very much appreciated!
-
- 898 Posts
this thing drove me nuts. I ended up rolling my own.
-
- 898 Posts
my rough script is:
$filePathTV = 'File';
$errorPage = '253';
$docId = $modx->documentIdentifier;
$getDocument = $modx->getDocument($docId, '*');
$alias = $getDocument['alias'];
$title = $getDocument['pagetitle'];
$file = $modx->getTemplateVarOutput($filePathTV, $docId);
$file = $modx->config['base_path'] . $file[$filePathTV];
$ext = substr(strrchr($file, '.'), 1);
if(ini_get('zlib.output_compression')) { ini_set('zlib.output_compression', 'Off'); }
header('Pragma: public');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Cache-Control: private',false);
header('Content-Type: force-download');
header('Content-Disposition: attachment; filename='.$title.'.'.$ext);
header('Content-Transfer-Encoding: binary');
header('Content-Length: '.filesize($file));
readfile($file);
-
- 898 Posts
Yup, create this as a snippet.
follow the FileDownloadPE instructions, but instead of the template saying [[FileDownloadPE]], it would be [[yournewsnippet]]
-
- 6 Posts
Thanks again. Hhm, I’m still not getting this to work, even with your script. If I change the template accordingly and put a snippet call in the site where I want to provide downloads, Firefox ask to download the whole site when clicking the link that should carry the user there. So, it seems I’ll finally have to have someone investigate this further directly on my site / code if I can find someone. Thanks anyway, again!
Regards, Ruceb