From: Rob H. <for...@us...> - 2002-01-02 23:42:30
|
Update of /cvsroot/sandweb/sandweb/lib/SandWeb In directory usw-pr-cvs1:/tmp/cvs-serv19290/lib/SandWeb Modified Files: File.pm Log Message: did some work on file download, works better now but for some reason prompts you to download sandweb.cgi if you try to "Save As" in the browser. Odd. Index: File.pm =================================================================== RCS file: /cvsroot/sandweb/sandweb/lib/SandWeb/File.pm,v retrieving revision 1.27 retrieving revision 1.28 diff -U2 -r1.27 -r1.28 --- File.pm 2001/12/22 22:01:54 1.27 +++ File.pm 2002/01/02 23:42:25 1.28 @@ -129,5 +129,4 @@ $log->debug("downloading file : $location/$filename"); - open FILE,"< $users_dir/$username/$location/$filename"; my $mime_type = _get_mime_type( @@ -138,6 +137,8 @@ 'log_obj' => "$log", ); + $log->debug("MIME type looks like : $mime_type"); + unless ($mime_type) { $mime_type = "binary/unknown"; @@ -145,7 +146,14 @@ print "content-type:$mime_type\n\n"; - foreach my $line (@file) { - print "$line"; - } + + if (open FILE,"< $location/$filename") { + while (<FILE>) { + print $_; + } + } else { + $log->debug("Can't download $location/$filename : $!"); + } + close FILE; + } |