fly: Documentation: Frequently Asked Questions

 [fly]

Table of Contents

  1. Frequently Asked Questions.
  2. Future Plans.

Frequently Asked Questions.

If you're using fly with perl on Windows NT or Windows 95, this may be of interest to you: From: http://www.activestate.com/support/faqs/win32/perlwin32faq7.html

7.3. How do I return a graphics file from a CGI script?

One of the big differences between UNIX and Win32 platforms is
that on Win32 there's a difference between text or ASCII files
and binary file. To return a graphics file, you need to specify
that the file is a binary file, and that the standard output
stream should accept binary data. Try something like this: 

    $MY_FILE_NAME = 'Penelope.jpg';
    $CHUNK_SIZE = 4096;

    open( MY_FILE, "<$MY_FILE_NAME" )
         or die( "Can't open $MY_FILE_NAME: $!\n" );

    print "Content-type: image/jpeg\r\n";
    print "\r\n";

    binmode( MY_FILE ); # These are crucial!
    binmode( STDOUT ); 

    while ( $cb = read( MY_FILE, $data, $CHUNK_SIZE ) )
    {
        print $data;
    }

    close( MY_FILE );

The Future (otherwise known as a to-do list).

I'm currently porting fly to the Macintosh. It will be an XCMD that can be used from Hypercard, MacPerl, Frontier (I think), and anything else that can use XCMDs or XFCNs.


[Home] [Documentation] [Copyright] [Feedback]


Created:       21 June 1995
Last modified: 10 June 1999
Access:        Unrestricted.
Copyright © 1994-1998 The University of Melbourne.
<URL:http://www.unimelb.edu.au/fly/>

Martin Gleeson, gleeson@unimelb.edu.au

HTML 4.0 Checked!