Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Prompt image save

by liverpole (Monsignor)
on Nov 11, 2011 at 15:54 UTC ( [id://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$..$/

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-18 18:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found