1097090
Fri 3 July 2009, 08:27 am GMT +0200
This pops up a dialog box: and says and allows me to save the file but; it does not save it as a zip file. I also notice that it does not put the extension .zip and if i manually change the downloaded file name to a .zip and try to open it says the file is corrupt.
main page form
<form id="form2" name="form2" method="post" action="zip3.php">
<label>Enter Username to get images for that user<br />
<input type="text" name="userName" id="userName" />
</label>
<input name="Submit2" type="submit" />
</form>
<?php
$userName = $_POST['userName'];
$_SESSION['userName'] = $userName;
?>
zip3.php
<?php
$filename = "upload_test/".$_POST['userName'];
$buffer = file_get_contents($filename);
/* Force download dialog... */
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
/* Don't allow caching... */
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
/* Set data type, size and filename */
header("Content-Type: application/octet-stream");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . strlen($buffer));
header("Content-Disposition: attachment; filename=$filename");
/* Send our file... */
echo $buffer;
?>
main page form
<form id="form2" name="form2" method="post" action="zip3.php">
<label>Enter Username to get images for that user<br />
<input type="text" name="userName" id="userName" />
</label>
<input name="Submit2" type="submit" />
</form>
<?php
$userName = $_POST['userName'];
$_SESSION['userName'] = $userName;
?>
zip3.php
<?php
$filename = "upload_test/".$_POST['userName'];
$buffer = file_get_contents($filename);
/* Force download dialog... */
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
/* Don't allow caching... */
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
/* Set data type, size and filename */
header("Content-Type: application/octet-stream");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . strlen($buffer));
header("Content-Disposition: attachment; filename=$filename");
/* Send our file... */
echo $buffer;
?>