We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10152
    • 156 Posts
    Hello,

    after following all the instructions the zip file is always 0 bytes.
    Only zip archive have this problem. If the downloaded file is .txt or .html, no problem.

    Here are my settings :
    template downloads : [!FileDownloadPE!]
    content type : application/zip
    set to attachment
    uncacheabe, unsearchable
    path : assets/files/downloads/file.zip
    MIME : application/zip (or force-download)
    phx desactivated
    modx 1.0.0

    The download is initiated and MIME type is reconized but file is empty. I have tryed many things, thanks in advance for for hints.

    EDIT : solved by replacing around line 75 in snippet :
    
                if (file_exists($path)) {
                    header('Content-Description: File Transfer');
                    header('Content-Type: application/octet-stream');
                    header('Content-Disposition: attachment; filename='.basename($path));
                    header('Content-Transfer-Encoding: binary');
                    header('Expires: 0');
                    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
                    header('Pragma: public');
                    header('Content-Length: ' . filesize($path));
                    ob_clean();
                    flush();
                }
    
                if ($read=readfile($path)){
                    exit;
                }else {
                    echo 'an error has occured, please contact the webmaster';
                }
    
    
                }

      • 12379
      • 460 Posts
      I’ve setup a pdf download using this snippet. The resulting error occurs when I drag it into Acrobat:

      "Acrobat could not open ’test-3.pdf’ because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn’t correctly decoded).

      To create an Adobe PDF document, go to the source application. Then print the document to Adobe PDF."

      The file itself in the download location is not corrupt.
        Mostly harmless.
        • 29877
        • 35 Posts
        Sounds like the problem I’m having.

        Quote from: hotdiggity at Oct 09, 2009, 04:22 AM

        I’ve setup a pdf download using this snippet. The resulting error occurs when I drag it into Acrobat:

        "Acrobat could not open ’test-3.pdf’ because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn’t correctly decoded).

        To create an Adobe PDF document, go to the source application. Then print the document to Adobe PDF."

        The file itself in the download location is not corrupt.
          • 29877
          • 35 Posts
          This plugin is becoming increasingly frustrating for me. The concept is wonderful. That is what drew me into using it in the first place. But when it only works for me half of the time, and I can’t even find the problem myself I want to ditch it and use something else. However, there is nothing else to choose from.

          There is a lack of support here and that upsets me. sad
            • 12379
            • 460 Posts
            While it hides the whereabouts of the file’s location, it doesn’t protect the file from link sharing, which is what I’m looking for - an expiring download link.
              Mostly harmless.
              • 31893
              • 4 Posts
              Hi, i’ve submitted an extension "Downloadable products for TreasureChest" (dp4tc) this afternoon, and it can do the job.

              It provides a list of single-download links after paypal payment, but you can use it alone to build restricted links without treasurechest.

              More infomations when (and if) extension will be approved.

              You can contact me if you want the extension before. Feedback needed, cheers wink

                • 12379
                • 460 Posts
                Great - look forward to it.
                  Mostly harmless.
                  • 25483
                  • 741 Posts
                  I installed everything like the manual says, but it doesn’t work with word documents. Word on Mac tells me that it is not a valid document. It looks like it misses a bit of the file so that it thinks it is corrupt.

                  Does anyone know how to let it work with word documents?
                    with regards,

                    Ronald Lokers
                    'Front-end developer' @ h2o Media

                    • 12379
                    • 460 Posts
                    This extension is in need of an update as all the files that do download aren’t recognisable - on Mac at least. Possibly PC too.
                      Mostly harmless.
                      • 25483
                      • 741 Posts
                      Did just a test on a Windows XP computer, same problem...
                        with regards,

                        Ronald Lokers
                        'Front-end developer' @ h2o Media