Warning: using FileZilla to publish password protected pages

We just found that FileZilla’s defaults interfere with how Sparkle generates assets that go inside password protected pages. If you place a video or PDF file inside a password protected page, Sparkle will wrap that in two PHP files, the first one that checks for the password, and the second that contains the actual original binary file content.

FileZilla defaults to an ASCII transfer for files with PHP extension, which means it will most likely corrupt the second file. This results in videos not playing and PDFs not loading (or showing up corrupt).

ASCII transfer generally means translating newline characters, which is 100% not necessary for PHP content, the PHP interpreter doesn’t not care about how newline characters are encoded, but in turn does break the video/PDF/etc file.

The best way to solve this would be to use Sparkle’s built-in FTP, but if for whatever reason your workflow is to export to disk and then upload with FileZilla, we recommend you change the FileZilla defaults like this:

  • either change the default transfer type to binary (top arrow)
  • or remove the php extension from the list of filetypes that are ASCII (bottom arrow)