FileDownloadPlugin
Votes: 15
Tags: plugin, file management
Submitted: Mar 2, 2007
Released: Mar 2, 2007
Downloads: 2527
License: GPL - GNU Public
Package Website
FileDownloadPlugin 1.2
Works with the following Version(s): 0.9.2.2 | 0.9.5
FileDownloadPlugin lets you bind a downloads folder to specific document using TV with folder path, and drive the file downloads with respect to document's permissions, large files, HTTP partial downloads, ETags, using i.e.:
http://www.mymodxsite.com/downloads.html/abao0995u.exe
http://www.mymodxsite.com/downloads.html&d=abao0995u.exe
http://www.mymodxsite.com/index?q=1&d=abao0995u.exe
Download
- repo-1348.zip (2527 downloads)
Description
The reason I wrote that plugin was that I needed secure downloads within the MODx site.
I've used FileDownload snippet, however attached to that download.php script was not respecting document's privileges, moreover it was exposing real (relative) paths of the files in the base64 encoded URL.
FileDownload snippet inspired me to write this plugin. Content type check code is being taken from FileDownload snippet (GPL).
My plugin exposes files binded to the document with TV variable "FileDownloadFolder". All files are relative paths to relative or abolute path specified in "FileDownloadFolder", while traverse up with ".." is not allowed.
Therefore user downloading files is not aware of the physical placement of those files. This placement can be even away the MODx install root or "assets", letting you bind some network "build" folder to the document.
If the file specified with "&d=" query parameter is found and accessible it is being streamed to the client, if the "&d=" file is invalid, no TV specified or it is not accessible the content of "parent" document is sent as if "&d=" was never specified.
FileDownloadPlugin features:
- handling file download relative to the document's TV "FileDownloadFolder"
- respecting document's privileges, since plugin code is not called if user has no document permissions physical paths are unknown to the user, and URL's are served friendly way
- support for large files, no timeouts, low (configurable) memory usage
- support for partial downloads HTTP/206 Partial Content used by download boosters
- support for modification/cache checking with HTTP/304 Not Modified
- support for long download, checks if the client has disconnected
Integration with FileDownload snippet
This plugin integrates with FileDownload snippet. You can use the snippet for embedding the file list onto the page while the plugin will be serving the downloads. Refer its documentation for details: http://modxcms.com/FileDownload-502.html
Instructions
Installation:
1) Create new TV called "FileDownloadFolder" in the MODx Manager
2) Open creation of new plugin called "FileDownloadPlugin"
3) Copy and paste "FileDownloadPlugin1.0.php" content from attached zip file
without 1st line "<?php" and last line "?>" into "Plugin code" editbox
3) Bind the plugin to OnWebPagePrerender event
4) Press "Save"
You may now start using plugin. Create new document called "downloads" and set
its "FileDownloadFolder" for instance to "D:/archives" path containing "myzipfile.zip".
From now http://www.mymodxsite.com/index?q=downloads&d=myzipfile.zip will stream
the client "D:/archives/myzipfile.zip" if only the client has access to "downloads"
document.
You may also change your ".htaccess" rewrite rule to:
RewriteRule ^(^/*)/?(.*)$ index.php?q=$1&d=$2 L,QSA
if you use friendly URLs and want to the file to be visible on:
http://www.mymodxsite.com/downloads.html/myzipfile.zip
Warning! Friendly URLs work only with flat document aliasing structure setting Use friendly alias path: No and therefore won't work for: http://www.mymodxsite.com/en/products/downloads.html/myzipfile.zip.
If you want you can use different variable name or memory block size for the plugin, just change the definitions at the beginning of the file:
define('FILE_DOWNLOAD_BLOCK_SIZE', 256 * 1024);
define('FILE_DOWNLOAD_VARIABLE', 'FileDownloadFolder');
That's all. Good luck. I waiting for comments on support forum thread.Updates
- Uses now getTemplateVarOutput so the folder variables are evalutated.
- Support for multiple ranges with multipart/byteranges especially useful when using embedded PDF files with Adobe Reader.
- Fixed Content-Range header which wasn't following HTTP/1.1 specification well.
Sub-Packages
Previous Releases
1.1
Votes: 11
Tags: plugin, file management
Submitted: Jan 3, 2007
Released: Jan 3, 2007
Downloads: 1399
License: GPL - GNU Public
Package Website
FileDownloadPlugin 1.1
Works with the following Version(s): 0.9.2.2 | 0.9.5
FileDownloadPlugin lets you bind a downloads folder to specific document using TV with folder path, and drive the file downloads with respect to document's permissions, large files, HTTP partial downloads, ETags, using i.e.:
http://www.mymodxsite.com/downloads.html/abao0995u.exe
http://www.mymodxsite.com/downloads.html&d=abao0995u.exe
http://www.mymodxsite.com/index?q=1&d=abao0995u.exe
Download
- repo-1254.zip (1399 downloads)
Description
The reason I wrote that plugin was that I needed secure downloads within the MODx site.
I've used FileDownload snippet, however attached to that download.php script was not respecting document's privileges, moreover it was exposing real (relative) paths of the files in the base64 encoded URL.
FileDownload snippet inspired me to write this plugin. Content type check code is being taken from FileDownload snippet (GPL).
My plugin exposes files binded to the document with TV variable "FileDownloadFolder". All files are relative paths to relative or abolute path specified in "FileDownloadFolder", while traverse up with ".." is not allowed.
Therefore user downloading files is not aware of the physical placement of those files. This placement can be even away the MODx install root or "assets", letting you bind some network "build" folder to the document.
If the file specified with "&d=" query parameter is found and accessible it is being streamed to the client, if the "&d=" file is invalid, no TV specified or it is not accessible the content of "parent" document is sent as if "&d=" was never specified.
FileDownloadPlugin features:
- handling file download relative to the document's TV "FileDownloadFolder"
- respecting document's privileges, since plugin code is not called if user has no document permissions physical paths are unknown to the user, and URL's are served friendly way
- support for large files, no timeouts, low (configurable) memory usage
- support for partial downloads HTTP/206 Partial Content used by download boosters
- support for modification/cache checking with HTTP/304 Not Modified
- support for long download, checks if the client has disconnected
Integration with FileDownload snippet
This plugin integrates with FileDownload snippet. You can use the snippet for embedding the file list onto the page while the plugin will be serving the downloads. Refer its documentation for details: http://modxcms.com/FileDownload-502.html
Instructions
Installation:
1) Create new TV called "FileDownloadFolder" in the MODx Manager
2) Open creation of new plugin called "FileDownloadPlugin"
3) Copy and paste "FileDownloadPlugin1.0.php" content from attached zip file
without 1st line "<?php" and last line "?>" into "Plugin code" editbox
3) Bind the plugin to OnWebPagePrerender event
4) Press "Save"
You may now start using plugin. Create new document called "downloads" and set
its "FileDownloadFolder" for instance to "D:/archives" path containing "myzipfile.zip".
From now http://www.mymodxsite.com/index?q=downloads&d=myzipfile.zip will stream
the client "D:/archives/myzipfile.zip" if only the client has access to "downloads"
document.
You may also change your ".htaccess" rewrite rule to:
RewriteRule ^(^/*)/?(.*)$ index.php?q=$1&d=$2 L,QSA
if you use friendly URLs and want to the file to be visible on:
http://www.mymodxsite.com/downloads.html/myzipfile.zip
Warning! Friendly URLs work only with flat document aliasing structure setting Use friendly alias path: No and therefore won't work for: http://www.mymodxsite.com/en/products/downloads.html/myzipfile.zip.
If you want you can use different variable name or memory block size for the plugin, just change the definitions at the beginning of the file:
define('FILE_DOWNLOAD_BLOCK_SIZE', 256 * 1024);
define('FILE_DOWNLOAD_VARIABLE', 'FileDownloadFolder');
That's all. Good luck. I waiting for comments on support forum thread.Updates
- BUGFIX: "Content-Length" was reported 1 byte larger than actual file size when "Range" was not specified. That could cause some file download managers report errors or broken downloads.
- Close integration with upcoming FileDownload 2.5 snippet. Refer snippet documentation.
1.0alpha
Votes: 11
Tags: plugin, file management
Submitted: Nov 18, 2006
Released: Nov 18, 2006
Downloads: 566
License: GPL - GNU Public
Package Website
FileDownloadPlugin 1.0alpha
Works with the following Version(s): 0.9.2.2 | 0.9.5
This version has been marked as deprecated. Please use a newer version.
FileDownloadPlugin lets you bind a downloads folder to specific document using TV with folder path, and drive the file downloads with respect to document's permissions, large files, HTTP partial downloads, ETags, using i.e.:
http://www.mymodxsite.com/downloads.html/abao0995u.exe
http://www.mymodxsite.com/downloads.html&d=abao0995u.exe
http://www.mymodxsite.com/index?q=1&d=abao0995u.exe
Download
- repo-1193.zip (566 downloads)
Description
The reason I wrote that plugin was that I needed secure downloads within the MODx site.
I've used FileDownload snippet, however attached to that download.php script was not respecting document's privileges, moreover it was exposing real (relative) paths of the files in the base64 encoded URL.
FileDownload snippet inspired me to write this plugin. Content type check code is being taken from FileDownload snippet (GPL).
My plugin exposes files binded to the document with TV variable "FileDownloadFolder". All files are relative paths to relative or abolute path specified in "FileDownloadFolder", while traverse up with ".." is not allowed.
Therefore user downloading files is not aware of the physical placement of those files. This placement can be even away the MODx install root or "assets", letting you bind some network "build" folder to the document.
If the file specified with "&d=" query parameter is found and accessible it is being streamed to the client, if the "&d=" file is invalid, no TV specified or it is not accessible the content of "parent" document is sent as if "&d=" was never specified.
FileDownloadPlugin features:
- handling file download relative to the document's TV "FileDownloadFolder"
- respecting document's privileges, since plugin code is not called if user has no document permissions physical paths are unknown to the user, and URL's are served friendly way
- support for large files, no timeouts, low (configurable) memory usage
- support for partial downloads HTTP/206 Partial Content used by download boosters
- support for modification/cache checking with HTTP/304 Not Modified
- support for long download, checks if the client has disconnected
Integration with FileDownload snippet
This plugin integrates with FileDownload snippet. You can use the snippet for embedding the file list onto the page while the plugin will be serving the downloads. Refer its documentation for details: http://modxcms.com/FileDownload-502.html
Instructions
Installation:
1) Create new TV called "FileDownloadFolder" in the MODx Manager
2) Open creation of new plugin called "FileDownloadPlugin"
3) Copy and paste "FileDownloadPlugin1.0.php" content from attached zip file
without 1st line "<?php" and last line "?>" into "Plugin code" editbox
3) Bind the plugin to OnWebPagePrerender event
4) Press "Save"
You may now start using plugin. Create new document called "downloads" and set
its "FileDownloadFolder" for instance to "D:/archives" path containing "myzipfile.zip".
From now http://www.mymodxsite.com/index?q=downloads&d=myzipfile.zip will stream
the client "D:/archives/myzipfile.zip" if only the client has access to "downloads"
document.
You may also change your ".htaccess" rewrite rule to:
RewriteRule ^(^/*)/?(.*)$ index.php?q=$1&d=$2 L,QSA
if you use friendly URLs and want to the file to be visible on:
http://www.mymodxsite.com/downloads.html/myzipfile.zip
If you want you can use different variable name or memory block size for the plugin, just change the definitions at the beginning of the file:
define('FILE_DOWNLOAD_BLOCK_SIZE', 256 * 1024);
define('FILE_DOWNLOAD_VARIABLE', 'FileDownloadFolder');
That's all. Good luck. I waiting for comments on support forum thread.
1.0
Votes: 11
Tags: plugin, file management
Submitted: Jan 2, 2007
Released: Jan 2, 2007
Downloads: 513
License: GPL - GNU Public
Package Website
FileDownloadPlugin 1.0
Works with the following Version(s): 0.9.2.2 | 0.9.5
This version has been marked as deprecated. Please use a newer version.
FileDownloadPlugin lets you bind a downloads folder to specific document using TV with folder path, and drive the file downloads with respect to document's permissions, large files, HTTP partial downloads, ETags, using i.e.:
http://www.mymodxsite.com/downloads.html/abao0995u.exe
http://www.mymodxsite.com/downloads.html&d=abao0995u.exe
http://www.mymodxsite.com/index?q=1&d=abao0995u.exe
Download
- repo-1247.zip (513 downloads)
Description
The reason I wrote that plugin was that I needed secure downloads within the MODx site.
I've used FileDownload snippet, however attached to that download.php script was not respecting document's privileges, moreover it was exposing real (relative) paths of the files in the base64 encoded URL.
FileDownload snippet inspired me to write this plugin. Content type check code is being taken from FileDownload snippet (GPL).
My plugin exposes files binded to the document with TV variable "FileDownloadFolder". All files are relative paths to relative or abolute path specified in "FileDownloadFolder", while traverse up with ".." is not allowed.
Therefore user downloading files is not aware of the physical placement of those files. This placement can be even away the MODx install root or "assets", letting you bind some network "build" folder to the document.
If the file specified with "&d=" query parameter is found and accessible it is being streamed to the client, if the "&d=" file is invalid, no TV specified or it is not accessible the content of "parent" document is sent as if "&d=" was never specified.
FileDownloadPlugin features:
- handling file download relative to the document's TV "FileDownloadFolder"
- respecting document's privileges, since plugin code is not called if user has no document permissions physical paths are unknown to the user, and URL's are served friendly way
- support for large files, no timeouts, low (configurable) memory usage
- support for partial downloads HTTP/206 Partial Content used by download boosters
- support for modification/cache checking with HTTP/304 Not Modified
- support for long download, checks if the client has disconnected
Integration with FileDownload snippet
This plugin integrates with FileDownload snippet. You can use the snippet for embedding the file list onto the page while the plugin will be serving the downloads. Refer its documentation for details: http://modxcms.com/FileDownload-502.html
Instructions
Installation:
1) Create new TV called "FileDownloadFolder" in the MODx Manager
2) Open creation of new plugin called "FileDownloadPlugin"
3) Copy and paste "FileDownloadPlugin1.0.php" content from attached zip file
without 1st line "<?php" and last line "?>" into "Plugin code" editbox
3) Bind the plugin to OnWebPagePrerender event
4) Press "Save"
You may now start using plugin. Create new document called "downloads" and set
its "FileDownloadFolder" for instance to "D:/archives" path containing "myzipfile.zip".
From now http://www.mymodxsite.com/index?q=downloads&d=myzipfile.zip will stream
the client "D:/archives/myzipfile.zip" if only the client has access to "downloads"
document.
You may also change your ".htaccess" rewrite rule to:
RewriteRule ^(^/*)/?(.*)$ index.php?q=$1&d=$2 L,QSA
if you use friendly URLs and want to the file to be visible on:
http://www.mymodxsite.com/downloads.html/myzipfile.zip
If you want you can use different variable name or memory block size for the plugin, just change the definitions at the beginning of the file:
define('FILE_DOWNLOAD_BLOCK_SIZE', 256 * 1024);
define('FILE_DOWNLOAD_VARIABLE', 'FileDownloadFolder');
That's all. Good luck. I waiting for comments on support forum thread.Updates* Quotes file names in the Content-disposition in case of filenames containing spaces.
* Changes double quote (if any) into single quote on Content-disposition.

Please login to comment.