Menu

Windows items fix

2001-10-28
2002-04-15
  • Chris Hyzer

    Chris Hyzer - 2001-10-28

    The problem is that items downloaded from a win32 server generate a server error (due to malformed headers).  On windows, you cant just print \n in the HTTP headers, because it isnt just a linefeed as in *nix.  This leads to the question:

    Now that Windows is supported, is the same testing done by metadot on a windows server as on a *nix server?  And if not, is it possible to post the testing scripts so someone at least can do the testing?

    The fix for this is as follows (including setting the content-type for some common types, which was a known-bug): gizmo.pm->www_download (sorry about linewrap)

    ##CH 01/10/28 fixed for item download problems on win32
    #    print "HTTP/1.0 200 OK\n";
    #    print "Content-Location: $file\n";
    #    print "Content-disposition: inline; filename=$file\n";
    #    print "Content-Type: application/octet-stream\n";
    #    print "\n";
    #    print "Content-Type: application/octet-stream\012\012\n";

    $type = 'application/octet-stream';
    $type = 'application/pdf' if ($file =~ /.pdf$/i);
    $type = 'application/zip' if ($file =~ /.zip$/i);
    $type = 'application/vnd.ms-excel' if ($file =~ /.xls$/i);
    $type = 'application/vnd.msword' if ($file =~ /.doc$/i);
    $type = 'application/vnd.ms-powerpoint' if ($file =~ /.ppt$/i);

    print CGI->header
    (
    -Content_Location=>"$file",
    -Content_disposition=>"inline; filename=$file",
    -type=>"$type"
    );

    thanks,
    chris

     
    • Nicholas Moline

      Nicholas Moline - 2001-11-06

      Please note you got to declare $type, the first $type = line should read my $type=

       
    • Anonymous

      Anonymous - 2002-04-15

      I am having a problem where downloading  powerpoint files give me a "Page cannnot be displayed" in the browser window.

      This fix did not fix the problem.

      Other file types (Word, pdf) seem to work fine.

      Any ideas????

      Thanks.
      Mike

       
      • Chris Hyzer

        Chris Hyzer - 2002-04-15

        This is just a mime-type issue.

        Find out what content-type header your server is sending (I dont think I ever tried powerpoint, so it might not have ever worked for me).  (packet sniffing is useful for this).  Compare this with what Microsoft recommends for powerpoint.  I thought it was 'application/vnd.ms-powerpoint' but you might want to doublecheck.

        Chris

        ps. if you still cant get it to work, or this is over your head, let me know and maybe i can get it working at home.  in this case send your platform and public URL if available so I can check it out.

         

Log in to post a comment.