Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Prompt image save

by liverpole (Monsignor)
on Nov 11, 2011 at 15:54 UTC ( #937603=note: print w/ replies, xml ) Need Help??


in reply to Prompt image save

Hi DreamT,

This works for me:

#!/usr/bin/perl -w use strict; use warnings; use CGI::Carp qw{ fatalsToBrowser }; use IO::File; my $png = "test.png"; my $fh = new IO::File($png) or die "Can't read file '$png' ($!)\n" +; my $nbytes = (-s $png); binmode $fh; my $data; sysread($fh, $data, $nbytes) or die "Failed to read data from '$png' ( +$!)\n"; print "Content-disposition: attachment; filename=$png\n\n"; print $data;

Update:  Removed '...' from .png filename in header.


s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/


Comment on Re: Prompt image save
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://937603]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2014-12-20 11:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (95 votes), past polls