CompressedUploads

Summary: Modify scripts/upload.php to work with bzip2 archives
Version:
Prerequisites:
Status:
Maintainer: Michael Savchuk -> mailto:mehos1 [snail] yandex [period] ru

Preamble

I am not native English speaker, so it would be great if you would correct my mistakes. I have a PMWiki installation on my flash disk. Naturally, it has a very small amount of free space.

Problem

Some Microsoft Word documents take up over a megabyte of memory. Of course, you can store the files as archives (gzip, zip, rar, or something similiar), but to read them you have to do the following:

  • Download the archive containing your document
  • Unpack it into a temporary directory
  • Open it with a suitable program

A bit cumbersome, isn't it? And of course there is a similar problem when uploading files to your wiki site.

Solution

I've made some changes to scripts/upload.php which allow it to work with bzip2 archives. Now the compression process is absolutely transparent for the user. Files are bzip2 compressed when uploaded to your server and expanded when downloaded.

Download

Download itΔ

Installation

Just copy this file to the wiki/scripts directory. The script is based on PmWiki 2.0.10.

Bugs

  • You should download php_bzip2.dll from http://www.php.net according to your version PHP and make some changes to php.ini . It would be great if someone could post php_bzip2 from PHP 4.4.0.
  • Don't forget, no changes are made to files extension so don't be confused if you download it directly from your drive and it doesn't work.
  • To use this feature $EnableDirectDownload MUST be set to 0. For safety reasons this option will be overriden in patched version of upload.php.
  • For now, you should compress all of your files before using. (Actually, I am not good in PHP yet, and this is not even alpha version. By the way, if anybody wants i can do such a thing with gzip, because it is natively supported, so no extra files are needed).

See also

  • Multi upload Upload multiple files at once by packing them in a zip archive & extracting them on the server

Contributors

Michael Savchuk -> mailto:mehos1 [snail] yandex [period] ru , 23 October.

Comments

See discussion at CompressedUploads-Talk