<?php
require_once('violetUtil.class.php');

$userId = $_REQUEST['userid'];
$appName = $_REQUEST['name'];
$timeStamp = $_REQUEST['id'];
$zipFileName = violetUtil::getTempPath('packages')."/Package_{$timeStamp}_{$userId}_{$appName}.zip";

$fileSize = filesize($zipFileName);
$fileHandle = fopen($zipFileName, 'rb');
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename='Package_{$appName}.zip'");
header("Content-Length: $fileSize");
fpassthru($fileHandle);
fclose($fileHandle);

unlink($zipFileName);
