daebat Posted January 28, 2010 Share Posted January 28, 2010 I need to modify the following script to, when clicked on, pop up a download box instead of viewing the jpg image, pdf, etc. <?php $data = mysql_query("SELECT * FROM flyers ORDER BY id DESC ") or die(mysql_error()); //Puts it into an array while($info = mysql_fetch_array( $data )) { //Outputs the image and other data Echo "<div style='float:left;padding-top:15px;'>"; Echo "<table width='225'>"; Echo "<tr><td colspan='2' style='text-align:center;text-transform:uppercase;'><b> ".$info['title'] . "</b></td></tr> "; Echo "<tr><td colspan='2' style='text-align:center;'><b> ".$info['description'] . "</b></td></tr> "; Echo "<tr><td colspan='2' style='text-align:center;'><a href='upload/flyers/".$info['image'] ."'><img src='upload/flyers/".$info['thumb'] . "' style='text-align:center;border:none;'></a></td></tr>"; Echo "<tr><td style='vertical-align: middle; text-align:center;font-size:x-small;'>Press Quality PDF</td><td><a href='upload/flyers/".$info['pdf'] . "'><img src='../associates/images/download.png' border='0' width='75'></a><br></td></tr>"; Echo "<tr><td style='vertical-align: middle; text-align:center;font-size:x-small;'>Microsoft Word</td><td><a href='upload/flyers/".$info['word'] . "'><img src='../associates/images/download.png' border='0' width='75'></a><br></td></tr>"; Echo "</table>"; Echo "</div>"; } ?> Quote Link to comment Share on other sites More sharing options...
Mchl Posted January 28, 2010 Share Posted January 28, 2010 You need help with that or want pay for that? Quote Link to comment Share on other sites More sharing options...
daebat Posted January 28, 2010 Author Share Posted January 28, 2010 I would like some help please. Quote Link to comment Share on other sites More sharing options...
oni-kun Posted January 28, 2010 Share Posted January 28, 2010 I would like some help please. You'd use the header() function. // We'll be outputting a PDF header('Content-type: application/pdf'); // It will be called downloaded.pdf header('Content-Disposition: attachment; filename="downloaded.pdf"'); // The PDF source is in original.pdf readfile('original.pdf'); A simple example to force download of a PDF rather than display it. But as mentioned, we're not going to write a huge snippet for you, Just going to help. Quote Link to comment Share on other sites More sharing options...
ChemicalBliss Posted January 28, 2010 Share Posted January 28, 2010 There are functions that can do this for you also if you google it, http://lmgtfy.com/?q=How+to+force+file+download+with+php -CB- Quote Link to comment Share on other sites More sharing options...
daebat Posted January 28, 2010 Author Share Posted January 28, 2010 thanks to chemical bliss for actually helping. oni-kun... good luck with being a douche. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.