9, February 2010

help needed with zipping a folder and downloading - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  WebDigity Community  >  Forum Lounge
Topic: help needed with zipping a folder and downloading
« previous next »
Pages: [1] Print

Author Topic: help needed with zipping a folder and downloading  (Read 390 times)
Google dot what?
*
Posts: 2
20 credits
Members referred : 0


« on: Jul 03, 2009, 09:27:51 am »

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;
?>
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=8892
Tags : downloading php zip files Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  WebDigity Community  >  Forum Lounge
Topic: help needed with zipping a folder and downloading
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Feb 09, 2010, 10:22:33 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!





Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2010 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.