#dynamically determine $outf="C:/folder1/test.xls; #dynamically determine $filenm="test.xls"; print "Content-Type: application/octet-stream\n"; print "Content-Disposition:attachment;filename=$filenm","\n\n"; print "Content-Length: $no_bytes","\n\n"; open(FILE,"<$outf"); while(){print;} close (FILE);