> What I was intending was to call the cgi script and rather than it
> printing the normal text/html header it would print the header directly,
> that way you are guaranteed to be operating the way you intended.

Hi Wiggins
Thanks for this suggestion... I've tried the following bit of CGI script with three different file types (.txt, .cgi, .dat) and in each case *DO* get the 'Save as...' dialogue box to come up and when I select 'Save to disk' and click ok, It appears as if a transfer occurs but only a zero-length file is saved to my local hard disk directory. The code is as follows...
============================================================================
#!/usr/local/bin/perl -w

# testoctetstream_1.cgi

# My base directory and base directory URL
my($basedir) = "<base directory>";
my($baseurl) = "<base URL>";

# Location of the file to be downloaded
$fileloc = "$basedir/cgi-bin/test/xxx.txt";
#$fileloc = "$basedir/cgi-bin/test/testdu1.cgi";
#$fileloc = "$baseurl/cgi-bin/test/testdu.dat";

# Name of file to be downloaded
$filename = "xxx.txt";
#$filename = "testdu1.cgi";
#$filename = "testdu.dat";

# NOTE: Uncomment the desired $filename and $fileloc above

# Set The headers
print "Content-Type: application/octet-stream;\n";
print "Content-Disposition: attachment; filename=\"$filename\"\n";

# ---------------------------------------------------------------
# Note: Can't figure out what to put in here to actually download
# the darn file!!!
# ---------------------------------------------------------------

print "\n";
exit;
============================================================================
The above cod was tested in both Mozilla and IE browers with the same results.


It appears I'm missing some statement that should follow the Content-Disposition
statement.

I've read the RFC 1806 document (http://www.faqs.org/rfcs/rfc1806.html) which provided several examples as shown below. Both examples are transferring a .jpg file and indicates that the .jpg file's data is to immediately follow the Content-xxxxx statments.... This is not what I'm looking for... What I need is a statement that will get the data from the
file that I'm trying to transfer...
=============================================================================

2.6  Content-Disposition and the Main Message

  It is permissible to use Content-Disposition on the main body of an
  [RFC 822 <http://www.faqs.org/rfcs/rfc822.html>] message.

3.  Examples

  Here is a an example of a body part containing a JPEG image that is
  intended to be viewed by the user immediately:

        Content-Type: image/jpeg
        Content-Disposition: inline
        Content-Description: just a small picture of me

        <jpeg data> <----------------------- ****

  The following body part contains a JPEG image that should be
  displayed to the user only if the user requests it. If the JPEG is
  written to a file, the file should be named "genome.jpg":

        Content-Type: image/jpeg
        Content-Disposition: attachment; filename=genome.jpeg
        Content-Description: a complete map of the human genome

        <jpeg data> <----------------------- ****


=============================================================================

Hopefully you can come up that missing statement that will perform the magic
I'm looking for or suggest somewhere else to look.....

Thanks again
Tony Frasketi

Reply via email to