#!/usr/bin/perl

$domain = "example.com";

$file = "http://example.com/test.jpg";

$upload = "/root/download";

unless ($ENV{'HTTP_REFERER'} =~ $domain) {
print "Location: $file\n\n";
exit;
}
($name,$ext)=split('&',$ENV{'QUERY_STRING'});

print "Content-type: image/" . (($ext eq 'jpg') ? 'jpeg' : $ext) . "\n\n";
open (image,"$upload/"."$name".".$ext") or die; 
while (read image, $buf, 1024) { 
print $buf;					 
}
close image;
Published in: CGI
Download

Related snippets