chaskins has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I've got the following code in a cgi script (perl);
print $query->header; print $query->start_html(-title=>'Connected to the NET', -name=>'conne +cted'); print "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" +codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/sw +flash.cab#version=4,0,2,0\" width=\"400\" height=\"300\">\n"; print " <param name=movie value=\"connecting.swf\">\n"; print " <param name=quality value=high>\n"; print " <embed src=\"connecting.swf\" quality=high pluginspage=\"http +://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=Sh +ockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"400\" h +eight=\"300\">\n"; print " </embed>\n"; print " </object>\n";
Which is supposed to display the .swf file. But when I run it from within a browser I get a blank page. When I right click on the on the page it say 'movie not loaded'. I also get the following message in the error log for the web site;

[Sun Mar 10 06:57:31 2002] [error] (8)Exec format error: exec of /var/ +www/cgi-bin/connecting.swf failed <br> [Sun Mar 10 06:57:31 2002] [error] [client 192.168.0.2] Premature end +of script headers: /var/www/cgi-bin/connecting.swf

I've cut and pasted the output'd HTML code into an editor and saved it into my HTML directory and run the page. It display from there.

Does anyone have any idea why it's not working?

Thanks
Chris

Replies are listed 'Best First'.
Re: Flash not displaying
by Chady (Priest) on Mar 10, 2002 at 07:54 UTC

    is your connecting.swf file located in cgi-bin? if not, make sure you specify the valid location... like: ../connecting.swf or something similar.

    also, if you intend on printing the html like this, why not qq[] instead of escaping?

    print qq[<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" +codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swf +lash.cab#version=4,0,2,0" width="400" height="300">\n]; print qq[ <param name=movie value="../connecting.swf">\n]; print qq[ <param name=quality value=high>\n]; print qq[ <embed src="../connecting.swf" quality=high pluginspage="ht +tp://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version= +ShockwaveFlash" type="application/x-shockwave-flash" width="400" heig +ht="300">\n];

    He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.

    Chady | http://chady.net/
      Maybe your 'connecting.swf' file should NOT be in the cgi-bin directory.

      Of course this depends on your configuration, but here it looks like your http server is trying to execute the .swf before sending it out since it is located in cgi-bin.

      Move it somewhere else (at the document root of your web server for example) and it should work just fine.
        I would concur, your code says...

        print " <embed src=\"connecting.swf\" ...

        which means a browser is going to try an load connecting.swf out of the same directory as the URL of the page that has it embeded -- in your case /cgi-bin. But .swf files are not executable, and your webserver is complaining that connecting.swf can't be executed.

        Move the SWF to some other directory on your server, and refer to it with a URL relative to your CGI ("../../wakko/dot.swf") or relative to your docroot ("/yakko/wakko/dot.swf").