Hi, all I have a form, upload in this case, from this upload i perform some functions then generate a zip file to download sent via headers // We'll be outputting a zip header('Content-type: application/zip'); header('Content-Disposition: attachment; filename=Download.zip'); // readfile($p_zipname); Okay all this works fine, however the orginal page is static and needs to be refreshed. I dealy i want to display a results page after the zip is created and offered for donwload. I have tried ob_start and such but no joy, may be doing it wrong Can any provide any hints, tips, or best a sample script cant find anything on the net So to reflect in short hand this is what i have <?php if(isset($_POST['SUBMIT'])){ //Perform Functions ...... //Send download header('Content-type: application/zip'); header('Content-Disposition: attachment; filename=Download.zip'); // readfile($p_zipname); // THIS IS THE PROBLEM BELOW echo Results } //Also this page stays statics still show the upload form with the file path in //Would like to get it reset also Main Upload page Details <form ...... ?> Code (markup): Any ideas
Could you do something like creating the zip file for download, and not in the headers. Something like: Resuts here... Your Zip file is ready - Click to Download or do you need to display the results after the file is downloaded?
That was my original idea, but the zip if is private and created off the web root and could get it to access the zip, tried a few ways of accessing it with no luck. The results dont really need to be shown, just more to reresh the form looks wierd with it not resetting.
What if you have the form post to a result page with a unique key, and the result page generates the zip. Post to a new page and generate the zip there. If the form has errors, you can return them back to the form page.
http://pear.php.net/package/Mail_Mime http://www.zend.com/pear/tutorials/Mail.php example sending text/html emails with attachments <?php include('Mail.php'); include('Mail/mime.php'); $text = 'Text version of email'; $html = '<html><body>HTML version of email</body></html>'; $file = '/home/richard/example.php'; $crlf = "\n"; $hdrs = array( 'From' => 'you@yourdomain.com', 'Subject' => 'Test mime message' ); $mime = new Mail_mime($crlf); $mime->setTXTBody($text); $mime->setHTMLBody($html); $mime->addAttachment($file, 'text/plain'); $body = $mime->get(); $hdrs = $mime->headers($hdrs); $mail =& Mail::factory('mail'); $mail->send('postmaster@localhost', $hdrs, $body); ?> PHP: