Hi, Here is code that I got from the internet for random image. This file works perfect if I try it independently but not on any existing file. I think the error that I am getting is quite common on the net but its new for me. I am getting this error: Warning: Cannot modify header information - headers already sent by (output started at /folder/test.php:12) in /folder/randomimage.php on line 19 the code that I got from net: <? $folder = 'images/'; $exts = 'jpg jpeg png gif'; $files = array(); $i = -1; if ('' == $folder) $folder = './'; $handle = opendir($folder); $exts = explode(' ', $exts); while (false !== ($file = readdir($handle))) { foreach($exts as $ext) { if (preg_match('/\.'.$ext.'$/i', $file, $test)) { $files[] = $file; ++$i; } } } closedir($handle); mt_srand((double)microtime()*1000000); $rand = mt_rand(0, $i); Line 19 is below: header('Location: '.$folder.$files[$rand]); ?> Thanks a bunch. Chris -- View this message in context: http://www.nabble.com/Include-file-error%2C-common-one-I-think-tf2971907.html#a8316202 Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php