# Check cookie and initialise a guest session if need be $sid = $q->cookie("CGISESSID") || undef; $session = new CGI::Session("driver:File",$sid,{'Directory'=>"./tmp/sessions"}); print $session->header(); #### print "Content-disposition: attachment; filename=$qstring\n"; print "Content-type: image/jpg\n\n"; open IMG, " 0) { print $buf; } flock IMG, 8; close IMG;