Memebers Area File Download

  • Hi,


    I have had several issues with the members app, but sorted most by removing the app and database entries and starting again.


    The only issue I have is when I click on the link to download a file added in the back office the file is not being downloaded and I just get a black page.

    I had an issue with the memcached php library but my hosting provider sorted this.


    Files appear on this page and when you hover over the link it shows the following. http://www.iksac.co.uk/members…ad.php?file=/filename.pdf


    If I put in a qualified link to the file directly the file will download.

    Code: buckets.php
    1. return array(
    2. 'secure' => array(
    3. 'web_path' => '/members/download.php?file=',
    4. 'file_path' => '/var/sites/w/www.iksac.co.uk/public_html/members_files',
    5. ),
    6. );


    The download.php is un-altered from the sample code given.

    Code: secure-file.html
    1. <perch:repeater id="Files" label="Secure Member Only Files">
    2. <li><a href="<perch:content id="file" type="file" label="File" order="2" bucket="secure" />">
    3. <perch:content type="text" id="desc" label="Title" order="1" required="true" title="true" />
    4. </a></li>
    5. </perch:repeater>


    The debug message from the main page load

    Code
    1. Debug Message
    2. [1] SELECT * FROM perch2_members_sessions WHERE sessionID='06fb45b6d4c1bbf4256312a9bf96ccd66315775c' AND sessionHttpFootprint='e2b242c30985c372980cd20d8433a9fe0e06797d' AND sessionExpires>'2019-02-04 16:57:50' LIMIT 1
    3. User is logged in
    4. [1] SELECT * FROM perch2_pages WHERE pagePath='/members/index.php' LIMIT 1
    5. Using template: /templates/pages/attributes/facebook.html
    6. Using template: /templates/pages/attributes/seo.html

    Output from the page that displays after clicking the download link

    Code
    1. Debug Message
    2. [1] SELECT * FROM perch2_members_sessions WHERE sessionID='06fb45b6d4c1bbf4256312a9bf96ccd66315775c' AND sessionHttpFootprint='e2b242c30985c372980cd20d8433a9fe0e06797d' AND sessionExpires>'2019-02-04 17:17:38' LIMIT 1
    3. User is logged in
    4. [1] SELECT * FROM perch2_pages WHERE pagePath='/members/download.php' LIMIT 1


    I am sure that this is something simple that I have missed any help will be appreciated.

  • drewm

    Approved the thread.
  • I have left the download as per the default. I didn't see the need to change it.

  • Same as before.

    Code
    1. Debug Message
    2. [1] SELECT * FROM perch2_members_sessions WHERE sessionID='2306984b65511b5d4bfbecbbd33138f717b725ef' AND sessionHttpFootprint='526c128160b99bde962deaec266d3dfbb4fd2ce3' AND sessionExpires>'2019-02-05 13:18:04' LIMIT 1
    3. User is logged in
    4. [1] SELECT * FROM perch2_pages WHERE pagePath='/members/download.php' LIMIT 1
  • Think I have found the problem.


    If you run the sql statement SELECT * FROM perch2_pages WHERE pagePath='/members/download.php' it is returning nothing.


    Should it?


    There are entries for '/members/reset.php', '/members/profile.php', '/members/index.php' etc.

  • Thanks for all you help Drew.


    I have tracked the issue down to the fact that the path for the bucket was incorrect!

    When I call the function perch_members_secure_download it does a check against the realpath. As these 2 paths were in fact incorrect it failed the test and dropped out.


    I corrected the paths and the downloads are firing as expected.


    Silly error one that I should have doubled checked first.