Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2010-07-09 17:54:23

nabrown78
Member
From: Northampton, MA, USA
Registered: 2006-10-04
Posts: 294
Website

Re: file_download directory problems

/file_download/ is a ‘virtual’ (well, fake) directory. It’s simply a trigger that TXP uses to initiate a download and update the download counters in the database. Behind the scenes, TXP takes the /id number, looks up the file name in the database and redirects to site.com/files/your_file_name to serve the file.

Question – is this process just there in order to keep the download count correct? So if you didn’t care about that, you could just create a link to a file like :

"linked text here":/files/file_name.pdf

if you were so inclined?

Offline

#14 2010-07-09 17:59:56

masa
Member
From: North Wales, UK
Registered: 2005-11-25
Posts: 1,095

Re: file_download directory problems

nabrown78 wrote:

Question – is this process just there in order to keep the download count correct?

That’s at least one reason. It also seems to force a download even when linking to files that the browser could display directly.

So if you didn’t care about that, you could just create a link to a file like linked text here if you were so inclined?

Yes that always works, too.

Offline

#15 2010-07-09 19:09:19

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: file_download directory problems

masa wrote:

That’s at least one reason. It also seems to force a download even when linking to files that the browser could display directly.

  • Plus it allows the files be outside public web root which makes it impossible to access the files directly.
  • Use plugins to protect the downloads, balance bandwidth etc.
  • By forcing the download, it might correct some issues where browser might block the file, modify it or treat it incorrectly. Usually you don’t want browser to read .exe’s or try to load .dlls.

Offline

#16 2010-07-09 19:38:20

nabrown78
Member
From: Northampton, MA, USA
Registered: 2006-10-04
Posts: 294
Website

Re: file_download directory problems

Gocom -

Thanks for your reply…very interesting! I have a client who is selling a subscription to an “e-course”. Along with emails, she wants to make some pdfs available for download to those who have purchased. You mention:

  • storing the files outside of the web root – but anyone with the proper link could still access it, right?
  • using plugins to protect downloads – can you suggest such a plugin?

Many thanks!

Offline

#17 2010-07-09 20:38:21

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: file_download directory problems

nabrown78 wrote:

  • storing the files outside of the web root – but anyone with the proper link could still access it, right?
  • using plugins to protect downloads – can you suggest such a plugin?

Yes, everyone with a proper TXP’s download link could access the files. The only plugin that comes to my mind is ign_password_protect. It has some features for protecting files.

Offline

#18 2010-09-29 19:30:00

coleyparka
New Member
Registered: 2009-10-13
Posts: 8

Re: file_download directory problems

Hi all

I seem to have inherited a similar problem to the one detailed in the first post in this chain. I’m no txp expert by any stretch, but I’ve been asked to add a downloads section to an active website which has been running on textpattern for a number of years (I had no involvement with the original configuration and have no contact with the person who originally built the site unfortunately). I can upload files to the “files” directory and edit them but get a “file not found” error whenever I try to download. The site seems to be successfully using clean URLs – there’s a plugin called zem_rewrite running and all the pages have human-readable URLs. The path to the files folder seems to be correct in the site preferences. I’m at a bit of a loss here, so any help would be much appreciated.

Cheers!

Offline

#19 2010-09-29 21:45:19

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: file_download directory problems

coleyparka wrote:

I can upload files to the “files” directory

Did you ‘import’ them in the Files tab as well? (see here)

If you did and it still doesn’t work, can you give an example of what a URL that returns the ‘file not found’ looks like?

I must say I’m not familiar with zem_rewrite, so I don’t know if and how that might interfere.

Offline

#20 2010-09-30 08:28:20

coleyparka
New Member
Registered: 2009-10-13
Posts: 8

Re: file_download directory problems

Yes, I did import via the files interface in textpattern rather than by ftp. Textpattern sees the files from the back-end, I can go in and edit them etc but when I click download (from the back or front end) I get this message:

The page you requested, file_download/3/Reverse-Booklet.pdf, was not found.

A typical url for file not found would be this:

http://example.com/file_download/3/Reverse-Booklet.pdf

The files folder is fully read/write, and I’ve also tried creating a different directory and pointing textpattern to that but I get the same result – works fine for import and edit but not for download.

Any help much appreciated.

Thanks

Offline

#21 2010-09-30 16:55:45

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: file_download directory problems

Have you tried if it works when you de-activate zem_rewrite?

Offline

#22 2010-10-01 08:34:33

coleyparka
New Member
Registered: 2009-10-13
Posts: 8

Re: file_download directory problems

Hi

Thanks for that suggestion – it seems to have worked, but not properly. Some files appear on the front end and download fine, but others don’t appear at all now. Do files need particular naming conventions in order to be visible to textpattern? I’m loading to one category and they work and then to another category and they don’t work, even though the pages are effectively the same.

Cheers

Offline

#23 2010-10-01 11:50:50

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: file_download directory problems

coleyparka wrote:

I’m loading to one category and they work and then to another category and they don’t work,

In that case it might be the tag that is used to display the files. Can you post it?

Offline

#24 2010-11-02 13:25:36

woof
Member
Registered: 2004-08-01
Posts: 128

Re: file_download directory problems

I’m having a problem with the paths in the generated tags from the tags links (textpattern, textile, xhtml) for file download when Textpattern is installed in a sub directory.

My sub directory is called 2010

The tags links in Content > Files generate paths like this
<a href="/file_download/15/filename.csv">filename.csv</a> i.e. pointing to the root

To work they should include the subfolder. i.e.
<a href="/2010/file_download/15/filename.csv">filename.csv</a>

I’m using the 4.3.0 release candidate. My site URL and file directory path appear to be correct so I cant figure out how to fix this…

Offline

Board footer

Powered by FluxBB