Created
September 1, 2013 19:09
-
-
Save halilim/6406548 to your computer and use it in GitHub Desktop.
GZip a File
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!empty($_POST) && isset($_FILES['file']) | |
&& $_FILES['file']['error'] == UPLOAD_ERR_OK | |
) { | |
header( | |
'Content-Disposition: attachment; filename="' | |
. $_FILES['file']['name'] . '.gz";' | |
); | |
echo gzencode(file_get_contents($_FILES['file']['tmp_name'])); | |
exit; | |
} | |
?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<title>GZip File</title> | |
</head> | |
<body> | |
<form method="post" enctype="multipart/form-data" action=""> | |
<input type="file" name="file" /> | |
<input type="submit" name="send" value="GZip File" /> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment