ToonMariner Posted November 29, 2006 Share Posted November 29, 2006 Hi people.I am having a little problem. I have a file download script that is working fine (for most users) but some report that the dialouge box that allows you to choose open or save (and subsequently pick where to save) is not displaying.The download begins automatically and users cannot find the file on their machines. I have just managed to replicate this in IE7 and it is a bit annoying!!! ;) Avant (using IE7's engine) works ok. IE6 with pop-up blocker installed has the same problem when you allow pop-ups from this site otherwise it blocks the pop-up.here is the download file..[code]<?php$error = NULL;$filename = isset($_GET['file']) ? $_GET['file'] : NULL;if ( ini_get('zlib.output_compression') ){ ini_set('zlib.output_compression', 'Off');}$file_extension = strtolower(substr(strrchr($filename,"."),1));if ( is_null($filename) ) { $erro = "Error: No file path passed to script."; exit;}else{ $first_char = substr($filename,0,1); if ( $first_char == "/" ) { $filename = substr(strtolower($filename), 1); } if ( !file_exists($_SERVER['DOCUMENT_ROOT'] . "/" . $filename) ) { $error = "Error: No such file found."; exit; }}switch ($file_extension){ case "pdf": $ctype = "application/pdf"; break; case "exe": $ctype = "application/octet-stream"; break; case "zip": $ctype = "application/zip"; break; case "doc": $ctype = "application/msword"; break; case "xls": $ctype = "application/vnd.ms-excel"; break; case "ppt": $ctype = "application/vnd.ms-powerpoint"; break; case "gif": $ctype = "image/gif"; break; case "png": $ctype = "image/png"; break; case "jpeg": case "jpg": $ctype = "image/jpg"; break; default: exit();;}header('Pragma: public');header('Expires: 0');header('Cache-Control: must-revalidate, post-check=0, pre-check=0');header('Cache-Control: private',false);header('Content-Type: ' . $ctype);header('Content-Disposition: attachment; filename="' . basename($filename) . '";' );header('Content-Transfer-Encoding: binary');header('Content-Length: ' . filesize($filename));readfile($filename);exit();?>[/code]PS As a side I would dearly love to get the downloads working as they do from download.com instead of this pop-up being the driving force. How can you achieve a download that is NOT affected by the pop-up blockers (or should I say what other method are available that could combat this issue.) 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.