• Make this not redirect to file name
    1 replies, posted
i have a script [PHP]<?php $folder = "swf/"; $swf = array(); $od_handle = opendir($folder); while ($filename = readdir($od_handle)) { if ( strlen ( $filename ) > 2 ) { $swf[] = $filename; } } closedir($od_handle); srand ((double) microtime() * 9999999999999999); $random_key = rand(0, count($swf) - 1); @header ( 'location:'. $folder . $swf[$random_key] ); ?>[/PHP] and i need to change [PHP]@header ( 'location:'. $folder . $swf[$random_key] );[/PHP] to make it just load the url but not redirect to the swf
You'll need to use readfile - something like this. It's from a download script I use. Though you'll need to find out and modify headers to fit those of a swf file. [php]<?php header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Type: " . $mm_type); header("Content-Length: " .(string)(filesize($filepath)) ); header('Content-Disposition: attachment; filename="'.basename($filepath).'"'); header("Content-Transfer-Encoding: binary\n"); ob_clean(); flush(); readfile($filepath); exit(); ?>[/php]
Sorry, you need to Log In to post a reply to this thread.