1
0
mirror of https://github.com/mrclay/minify.git synced 2025-02-23 08:25:12 +01:00
minify/min_extras/tools/encodeFile.php
Steve Clay 66aba1fd2a + memcached test (buggy on Windows at least)
all min_extras apps use the cache path and lib location specified in min/config.php
2008-09-04 20:50:28 +00:00

34 lines
971 B
PHP

<?php
if (isset($_FILES['subject']['name'])) {
require '../config.php';
require 'HTTP/Encoder.php';
$he = new HTTP_Encoder(array(
'content' => file_get_contents($_FILES['subject']['tmp_name'])
,'method' => $_POST['method']
));
header('Content-Type: application/octet-stream');
header('Content-Transfer-Encoding: binary');
header("Content-Disposition: attachment; filename=\"{$_FILES['subject']['name']}."
. ($_POST['method'] == 'deflate'
? 'zd'
: ($_POST['method'] == 'gzip'
? 'zg'
: 'zc'
)
) . '"');
$he->encode(9);
echo $he->getContent();
exit();
}
?>
<form enctype="multipart/form-data" action="" method="post">
<p>Encode <input type="file" name="subject" /><br />
as <input type="submit" name="method" value="deflate" />
<input type="submit" name="method" value="gzip" />
<input type="submit" name="method" value="compress" />
</p>
</form>