in reply to Re: FTP from web pages
in thread FTP from web pages

The other way (useful when generating files or extracting them from somewhere) is to:
print "Content-Type: image/gif\n\n"; #for example while (<YOUR_FILE>) { print; }
</CODE>
-- Daniellek

Replies are listed 'Best First'.
Re: Re: Re: FTP from web pages
by $code or die (Deacon) on Dec 20, 2000 at 18:18 UTC
    This is quite a nice way of doing it. However, if the script that prints this is called "download.pl" then your browser will prompt to save the gif as download.pl.

    You can supply a different default filename by adding this to the headers:
    print "Content-Disposition: attachment;filename=filename.ext";
    where you can change filename.ext to whatever you want.
        Nice one! Is that Apache (or similar) specific?

        I.e. Might some web servers report a 404 error because the script doesn't technically exist at that location?

        For those that haven't looked at this column of Merlyn's, he does a post to /path_to_cgi/scriptname.pl/desired_filename.ext

        For anyone else reading this, I recommend looking at Merlyn's site because there are a lot of useful ideas and snippets of code that one can use quite often.
      I used that once upon a time, but my Netscape didn't support that, and i still got "download.pl" as a name of file :-(

      It's IE only supported AFAIK

      -- Daniellek