Forums / Developer / Downloading files from var

Downloading files from var

Author Message

Jorge estévez

Tuesday 23 March 2010 5:30:42 am

I have a file at /var (tryed with files of type .txt .pdf .csv)

When I try to Get that file (I supose it will try to download it) via www.mysite.com/var/THEFILE.XXX it comes up with the

Module Not found

How can I get files from the var directory?

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Peter Keung

Tuesday 23 March 2010 8:31:49 am

Part of the standard rewrite rule set is:

RewriteRule ^/var/storage/.* - [L]
 RewriteRule ^/var/[^/]+/storage/.* - [L]

This facilitates you placing files to download in the var/storage directory (or in sub-folders of the var/storage directory).

http://www.mugo.ca
Mugo Web, eZ Partner in Vancouver, Canada

Bertrand Dunogier

Moderated by: Nicolas Pastorino

Tuesday 23 March 2010 11:51:56 am

Peter's answer will indeed solve the issue, but you should be careful, though, as using this will make any file in var/ available publicly, while they're usually downloaded using the content/download script.

If you have a known pattern for these files, you could limit the rewrite rule:

RewriteRule ^/var/[^/]+/storage/THEFILE\.XXX - [L]

Bertrand Dunogier
eZ Systems Engineering, Lyon
http://twitter.com/bdunogier
http://gplus.to/BertrandDunogier

Kristof Coomans

Tuesday 23 March 2010 1:10:03 pm

Why not changing the rewrite rules suggested in the documentation, to something more secure?

Also see http://ez.no/doc/ez_publish/technical_manual/4_x/installation/virtual_host_setup#comment17679

I'm pretty sure there is an issue about this also in the issue tracker, can't find it back though (might be because I don't see security issues anymore).

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Nicolas Pastorino

Wednesday 24 March 2010 4:18:27 am

"

Why not changing the rewrite rules suggested in the documentation, to something more secure?

"

Good point yes. Pushing this to engineering.
Thanks Kristof

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye