|
Posted by xhoster on March 12, 2008, 2:04 pm
Please log in for more thread options
> On 3$B7n(B12$BF|(B, $B>e8a(B12$B;~(B49$BJ,(B, xhos...@gmail.com
> wrote:
> > > In order to hidden the real path, I send the png file via CGI, e.g.
> >
> > > ##############
> >
> > > print "Content-type:image/png\n\n";
> > > my $file = "test.png";
> >
> > > open INPUT_FILE, "$file" or die "Couldn't open file: $!";
> > > while( sysread(INPUT_FILE, $data, 10240) ) {
> > > print $data;
> > > }
> > > close FILE;
> >
> > > ##############
> >
> > > Any faster/better method?
> >
> > Take a step back and do some introspection on why you want to hide the
> > real path in the first place.
> >
> > Xho
>
> An example would be captcha images, good reason?
Probably not. I would expect captcha images to be either generated on the
fly or stored in a database, so there is no path to hide. Or selected on
the fly, in which case your goal is not to hide the path but to select the
path.
Given that you are going to start up Perl in the first place, I don't
see any obvious problems with our code, other than possibly a lack of
error checking on the sysread. And that the file handle you close
is different than the file handle you open.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
|