goldsky / filedownload-r Goto Github PK
View Code? Open in Web Editor NEWFileDownload snippet for MODX revolution
FileDownload snippet for MODX revolution
Hi! I'm trying to get this to work but unfortunately i cannot get my files to download with your filedownload R snippet. The Snippet creates a list of all my files in a directory - so far so good but when i click on a link to download a file i get redirected to the page with the "hashed link". Then the Filedownloader list dissapears and no download starts.... I noticed that i get an installation error : Could not load class: FDL from mysql.fdl. but the installation still continues and finishes.
I tried modx 2.1.1 and modx 2.2.5 with the same results. What am i doing wrong? Can i switch of the hash link thing? Is there something missing? Would be great if you could help me solve this problem!
Thanks a lot!
How to use path as navigation (with links)?
like:
root-link / dir1-link / dir2-link/
Inconvenient always click browser back-button.
the browseDirectories doesn't work good for multiple snippet calls.
need to separate identifier for each of snippet calls.
Hi Goldsky,
This is a great extra, but I'm having a little trouble. I've left everything at its default and used this tag:
[[!FileDownload?
&getDir=`[[++core_path]]components/notify`
&browseDirectories=`1`
&groupByDirectory=`1`
]]
Everything looks fine and I can navigate through the subdirectories, but I can only download files that are in the notify directory. Trying to download files in directories below it just reloads the page, which shows no output from FDR.
Downloading files in the notify directory works fine.
Am I doing something wrong?
When I upload a file it doesn't link to my domain directly. It breaks because it's going all the way back to my root folder (my Modx site is in a sub folder with my other domain pointing to it).
The file paths look like:
http://www.domain1.com/home3/rootfolder/public_html/domain2folder/assets/portfolio/print.pdf
I have been trying to get it to look like this:
http://www.domain2.com/assets/portfolio/print.pdf
All my other packages work fine with this. How can I correct this?
Hi!
How to fix russian text!
Set locale UTF8 does not help
My apologies if I've missed the option but I would like a simple way to put the file listing above the directory listing.
The extra worked fine straight out of the box, I'm using the example with
[[!FileDownload?
&getDir=`assets/downloads`
&browseDirectories=`1`
&tplWrapper=``
&tplWrapperDir=`tpl-wrapper-dir`
&tplWrapperFile=`tpl-wrapper-file`
]]
However I'm trying to list an archive of newsletters so I would prefer to list the files first before the directories. I've created directories for 2011, 2010 etc and being older newsletters I'd like the tpl-wrapper-dir output to appear below the tpl-wrapper-file output.
Many thanks.
You forgot to replace $tpl to $tplChunk in lines:
$tplChunk = ltrim($tpl, ':');
$tplChunk = trim($tpl);
...
$chunk = $this->modx->getParser()->getElement('modChunk', $tpl);
So with such binding no chunk can be found.
https://github.com/goldsky/FileDownload-R/blob/master/core/components/filedownloadr/models/filedownload/filedownload.class.php
When using the dateFormat parameter to change the date format to anything other than the default, attempting to sort the file list by date results in the list being sorted by how the date displays, not the actual date itself.
For example, if I have the following dates in desc sort order,
2013-01-18
2013-02-25
2013-03-7
if I then apply &dateFormat=d/m/Y
, the list is sorted by day, not the entire date
7/03/2013
18/01/2013
25/02/1013
Full call:
[[!FileDownload? &getDir=/2013
&sortBy=date
&sortOrder=desc
&countDownloads=1
&tplWrapper=fdTable
&dateFormat=d/m/Y
]]
filedownloadr-1.1.3-pl
MODX Revolution 2.2.2-pl
rename table fd_count
to fd_paths
Hi,
Seems that adding saltText parameter makes no difference?
upload window stays open without sucess
using the filemanager is ok. only u2u gui fails.
----sorry, wrong board--
In response to my form post (http://forums.modx.com/thread/70168/support-comments-for-filedownload-r-1-0-0-beta2#dis-post-506596).
I'm having a problem with FileDownloadLink. I'm using it in a getResources tpl to provide direct downloads. I'm providing the link to the resource with FileDownloadLink to hide the path. This works great on most pages but not on a specific resource where there is a get variable in the URL (necessary to show the correct files). The url for this is: www.mywebsite.nl/docs?cat=7
When I click a download link 2 things happen:
- the page reloads but without the variable 'cat' thus the wrong content is shown
- no file is downloaded
Here is my solution. My variable ("voor") is hardcoded, so the code needs to be altered. But it might help you.
Snippet FileDownloadLink around line 322
if (!empty($queries['id'])) {
// non FURL
$baseRef = $xRef[0] . '?id=' . $queries['id'];
}
else if (!empty($queries['voor'])) {
// With "voor" var in URL
$baseRef = $xRef[0] . '?voor=' . $queries['voor'];
}
else {
$baseRef = $xRef[0];
}
File core/components/filedownloadr/models/filedownload/filedownload.class.php around line 1005
else {
if ($_GET['voor']) {
$args = 'voor=' .$_GET['voor'];
}
$args .= '&fdlfile=' . $hash;
$url = $this->modx->makeUrl($this->modx->resource->get('id'), $ctx, $args);
$link['url'] = $url;
}
MODX 2.2.15
Fliedownload R 1.1.7
Hi,
Using it for the first time (revo 2215) to display on a private page the files contained into a directory ABOVE the httpdocs.
This dir is associated to a media source for easy manager uploads.
The final folder name comes frome an extented fields defined on the user's manager page.
As the user must be logged the Profile snippet is run at the beginning of the page, thu we get all user's placeholders.
[[+privateDIR01]] is the targeted forlder.
[[!FileDownload?
&getDir=/var/www/vhosts/XxXXxx/Priv_downloads/[[+privateDIR01]]/
&browseDirectories=0
&dateFormat=d/m/Y
&fileCss=[[++assets_url]]templates/tpl1/css/fd.css
]]
The output is TRIPLE what it should be. 2 files in the test folder but the list is :
file1
file2
file1
file2
file1
file2
??
Thank you
Is there a way to solve my problem ? I've lost all the counts of downloads and it's not working anymore since I've upgraded, where the values remains in db.
Here's the chunk used :
[[!FileDownloadLink? &getFile=
[[+file]] &countDownloads=
1 &tplCode=
[[+title:default=
[[+filename]]
]]
| [[+sizeText]] - [[+date]]([[+count]] téléchargements) &dateFormat=
d-m-Y &toArray=
0 ]]
Counts are reseted and are stuck to 0.
I've 3 tables in my db :
fd_paths, fd_counts and fd_downloads
The counts are stored in fd_counts but not incrementing anymore.
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/34390023-count-not-working-after-upgrade-to-2-0?utm_campaign=plugin&utm_content=tracker%2F1480317&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F1480317&utm_medium=issues&utm_source=github).Hi.
Sorry for the translation of google.
How to run a snippet twice on the same page with different settings and folders?
Hello, I have a problem with your plugin.
When downloading the file gives the error:
[2016-05-18 17:03:44] (ERROR @ /index.php) fdPaths: Attempt to set NOT NULL field media_source_id to NULL
[2016-05-18 17:03:45] (WARN @ /public_html/core/components/filedownloadr/model/filedownloadr/filedownloadr.class.php : 2261) PHP notice: Undefined index: mediaSourceId
[2016-05-18 17:03:45] (WARN @ /public_html/core/components/filedownloadr/model/filedownloadr/filedownloadr.class.php : 780) PHP notice: Undefined index: mediaSourceId
[2016-05-18 17:03:45] (WARN @ /public_html/core/components/filedownloadr/model/filedownloadr/filedownloadr.class.php : 2242) PHP notice: Undefined index: mediaSourceId
[2016-05-18 17:03:45] (WARN @ /public_html/core/components/filedownloadr/model/filedownloadr/filedownloadr.class.php : 791) PHP notice: Undefined index: mediaSourceId
[2016-05-18 17:03:45] (WARN @ /public_html/core/components/filedownloadr/model/filedownloadr/filedownloadr.class.php : 2242) PHP notice: Undefined index: mediaSourceId
It helps clearing the cache, but after the first boot again gives the same error.
Sorry for the English (I'm from Ukraine)
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/34349587-fdpaths-attempt-to-set-not-null-field-media_source_id-to-null?utm_campaign=plugin&utm_content=tracker%2F1480317&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F1480317&utm_medium=issues&utm_source=github).Hi, I now have an issue with very large zip archives not appearing in the directory list at all. I know they are there as I can see them via ftp, or if I enable web directory listing (using .htaccess). Could this be a limitation with ModX, as the same thing happens if I try to use the similar FileLister add-on? Is there a single filesize limit within Modx itself - I can't find any documentation on this...?
Hi!
Snippet call
[[!FileDownload? &getDir=[[++base_path]]some/path/]]
is in the start document. It loads and shows all files correctly. But when I try to download something when accessing it from the base_url (http://my.site), I see the issue form the subject.
When I load http://my.site/index.php?id=1 - everything works fine.
All the pathes are equal on both pages.
MODX Revo 2.2.11. Tested on localhost (Ubuntu server 12.04.3) and on Hetzner VPS.
The faulty link: http://bonflash.it.cx/modx-revo-test/
The working link: http://bonflash.it.cx/modx-revo-test/index.php?id=1
Thanks!
Special Characters as ü or ä will be converted in latin on server for folder- or filenames. In diplayed links in the frontend and foldernames it is not displayed correct.
I try to access to drop box media source but doesn't work. You ca write e documentation ?
This is my snippest:
[[!FileDownload?
&getDir=`tests/`
&mediaSourceId=`6`
&tplFile=`jsDownload`
&tplWrapper=`jsDownloadwp`
&dateFormat=`d-m-Y`
&sortBy=`date`
&sortOrder=`DESC`
]]
But i recive this error:
"Principal 3 does not have permission to load object of class modContext with primary key: mgr"
and i don't see anything.
In my opinion this parameter "getDir" doesn't need, because in my dropbox app i select the directory.
Hi again,
is there any option to allow loading listings for empty folders? At least wrapper template with path. Or is it a bug, when I get no data from FD after I navigate to empty subfolder?
Thanks
I am using filedownloadr-1.1.7-pl
I like to use Multiple snipplets in one page:
[[!FileDownload?&getDir=assets/downloads/images
&fdlid=1
]]
[[!FileDownload?&getDir=assets/downloads/documents
&fdlid=2
]]
In images there are 2 files: img1 and img2
In docs there are 2 files: doc1 and doc2
The output is:
header
img1
img2 (=is ok)
header
img1
img2
img1
img2
doc1
doc2 (=strange)
Is there a way to clear the list or to prevent files "img1" and "img2" appearing in the second part of the output?
I tried to add &fdlid=1
but no effect.
Thanks for your help!
I was trying out using directLink as I had a report that some people were getting their downloads blocked due to the use of application/force-download in the script in normal mode, but am having trouble with the resulting links missing a character.
[[!FileDownload? &getDir=documents/General/
&browseDirectories=1
&extShown=pdf
&directLink=1
]]
The links generated are showing ocuments instead of documents. This is on PHP 5.4.27 and Modx 2.2.14. Am I doing something wrong?
thanks
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
http://forums.modx.com/thread/75457/filedownload-r-filedownload?page=2#dis-post-433472
Only in IE and only in pop-up downloading window, name of the file remained in the wrong encoding.
Corrected this file modification \core\components\filedownload\models\filedownload\filedownload.class.php
Line 669:
header ('Content-Disposition: attachment; filename = "'. basename ($ filePath). '"');
replaced by
header ('Content-Disposition: attachment; filename = "'. basename (iconv ('utf-8', 'windows-1251', $ filePath)). '"');
I know this has been raised but still getting duplicate items in sub folders when i select multiple directories and then have the groupByDirectory option set.
Hello, i want to get a list of files out of a directory and used filedownload-r to generate this. Everything is easy in the main language version, but for the second language it will not work.
The links generated miss the /en/ and there is no chance to get this. Also it seems that the special chunks for "tplFile" isn't working.
This is how i made the directory listing:
[[!FileDownload? &getDir=
[[++base_path]]XXX/YY/&browseDirectories=
1&dateFormat=
d.m.Y&fileCss=
disabled&fileJs=
disabled&tplWrapper=
en.DownloadWrapperTpl&tplFile=
en.DownloadFileTpl]]
Hi goldsky!
I would like to display only files with a name containing a given substring (in fact the substring will be the username of the currently logged in user). I thought to do it in _getDirContents around line 840
by only appending $fileInfo if it satisfies some criteria. Do you see a better way of doing this?
Maybe this could also be a feature request.
Best regards,
Pier
Do not operate the cache link in the https protocol
system settings:
server_protocol - https
php 5.4
modx 2.4.2
Browser:
Failed to load resource: the server responded with a status of 401 (Unauthorized)
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The counter doesn't update after download the file
I have to refresh the page to update the counter
[[!FileDownloadLink?
&getFile=[[+file]]
&countDownloads=1
&tplCode= <a href="[[+link]]" title="[[+filename]]"> [[+filename]] ([[+count]] downloads) </a>
]]
or I am missing something?
Thanks
[[+fd.image]] only outputs the path to "assets/components/filedownloadr/img/filetypes/" without any file of the folder
I just installed the plugin and am using the example (modified the getDir bit), and it displays whats in the image below. Clicking on any link (folder or file) redirects me to the homepage but in the address bar it displays the ?fdlfile=[random characters] at the end of the link.
The only properties on the FileDownload snippet I have modified was changing browseDirectories and groupByDirectory to yes and that was after the first few attempts of troubleshooting the issue.
I am using 1.1.7-pl. Only other packages I have installed is PageLocker 1.1.0, SimpleSearch 1.8.1, and Wayfinder 2.3.3-pl.
[[!FileDownload? &getDir=downloads/Membership
&browseDirectories=1
&groupByDirectory=1
]]
Hi there,
I have an issue where files of size 40mb or more cannot be downloaded - the browser finds the file but downloads an empty version of it. I used to have Modx 0.9.6.1 running on the same server and used FileDownload 2.6 and had no problem with bigger files. I thought perhaps this was something to do with the hash - is there any way to disable the hash and have the file link directly to the URL of the file on the server as a work-around? I'm not concerned about the security that the hash adds - it would be nice to have an option to turn it off. If you can think of any other solution then let me know!
Many thanks,
Dave
I think will be more convenient if database contains relative paths to files but not absolute. So if I change server absolute path to files might be changed. And then FileDownloadR begin to count all files from 0. Or the best way will be if you connect extra with Media Sources.
Here is my resource
[[!FileDownloadLink?
&getFile=download/version1.exe
&userGroups=Userss
&countDownloads=1
&tplCode=<a style="line-height:16px;" href="[[+link]]" title="[[+filename]]"> <img src="assets/template/style/exe-icon.gif" alt="" width="16" /> Descargar [[+filename]] ([[+count]] downloads)</a>
]]
but the count always stays 0
PS:
also, I suggest counting downloads by real name, no by hashed name, because its safer to provide a new link every time a user downloads the file (to force users to register on the site) and to prevent downloads by direct link outside the site.
Edit:
Maybe the problem is here? (filedownloadlink.snippet.php)
if (!empty($_GET['fdlfile'])) {
if (!$fdl->checkHash($modx->context->key, $sanitizedGets['fdlfile']))
return FALSE;
$downloadFile = $fdl->downloadFile($sanitizedGets['fdlfile']);
if (!$downloadFile) {
return '';
}
return '';
}
you are returning '' always
Hi,
browseDirectories link is not working when downloadByOther enabled. Directory doesn't open.
I often have uses working with extra this snippet.. issues with output filters and the like, and I think many of them are caused by the fact we're forced to use an inline template. MODX parses recursively so I'm going to guess that whenever an output filter is used, the entire placeholder is REMOVED, and FileDownload R cannot access it. I've had the same issue with the Login snippet for example, but at least that one offers the possibility to use a chunk.
Using chunks will fix issues like these. Keep it as an option if you worry about backwards compatibility.
Hi.
Sorry for the translation of google.
How do I get the relative path without the hash?
& DirectLink = 1
- shows the full path.
When I click on a download link that FileDownload-R generated, it just redirects back to the page that called the page to generate the list of files to download...It used to work before, and I haven't changed anything.
Tried reinstalling, only "error" i get is: Could not load package metadata for package filedownload.
But it still installs.
Placeholders require prefix to avoid confliction with other packages
http://forums.modx.com/thread/83109/wayfinder-filedownload#dis-post-458540
When SEF is on, a page with FileDownload call has some non-ASCII (for example, Russian) symbols in it's alias and hashing in FileDownload is enabled, clicking download links on this page thows 403 (or 401 on my other Revo instance). If the alias is in ASCII only, everything works fine.
The pages are absolutely identical, except for their IDs, titles and aliases. The call is:
[[!FileDownload? &getDir=`[[++base_path]]price-lists/` &directLink=`0`]]
Here it works: http://baikal-saz.ru/personal.html
Here it doesn't: http://baikal-saz.ru/%D0%BB%D0%B8%D1%87%D0%BD%D1%8B%D0%B9-%D0%BA%D0%B0%D0%B1%D0%B8%D0%BD%D0%B5%D1%82.html
I would also like to mention, that the same Russian symbols don't show up correctly in the list (though, they download OK). For example, on the page above the balnk-named text file is actually called "приколы.txt"
After navigating to a path when trying to download a file it never starts downloading. This is occurring with Revo 2.3.2.
running modx 2.2.6 with php5.4.9 and getting the following error/warning:
Only variables should be passed by reference in ....../core/components/filedownload/models/filedownload/filedownload.class.php on line 583
caused by:
[[!FileDownloadLink?
&getFile=[[+download]]
When trying to use foldernames with an ampersand in the '&getDir' property, the folder doens't show up. All the other folders are shown.
When setting '&browseDirectories=1', on one of the parents folders the folders with an ampersand are shown.
the hashed downloadlink is targeting something like index.php?id=1&fdldir=ZmLkBJH3LmWyZGN..., but not downloading or browsing folders. So I end up with a blank page (or had some times a Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 130968 bytes) in /www/htdocs/w01083c7/www1/core/xpdo/om/xpdoobject.class.php on line 161)
Only way is to deactivate the hashing, but this effects only files and not folders, and is of course less secure.
It looks like it's impossible to make case insensitive sort with natural sort turned off.
[[!FileDownload? &getDir=files/old
&directLink=1
&countDownloads=0
&sortByCaseSensitive=0
&sortOrderNatural=0
]]
it produces the following:
Cfile_09.exe
Lfile_11.exe
Mfile-191.exe
iFile.exe
but I hope it would be
Cfile_09.exe
iFile.exe
Lfile_11.exe
Mfile-191.exe
I guess SORT_STRING | SORT_FLAG_CASE options must be added to asort / arsort function calls by default.
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/38983020-natural-sort-and-case-sensitive?utm_campaign=plugin&utm_content=tracker%2F1480317&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F1480317&utm_medium=issues&utm_source=github).Hi,
I'am using CSS preprocessor Sass and importing fd.css to my app.css. To avoid double loading styles, I would like to disable appending of LINK tag with fd.css stylesheet into HEAD.
Based on documentation, I set &fileCss parameter to `` (empty string), but the empty LINK tag is still appending.
It would be nice, if FD-R tested &fileCss first and if it’s empty, no LINK was appended.
Thanks for Your great work on FD-R.
Froggiewalker
Hello,
I listen 2 folders: Logo (5 files) , Immagini (2 file), the files in the first folder are repeated in the second folder, where is the problem?
[[!FileDownload?
&getDir=assets/Files/Brand/Logo, assets/Files/Brand/Immagini
&groupByDirectory=1
]]
Thanks, regards.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.