Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forcing pictures to Expire from Browser cache

Status
Not open for further replies.

ecokid

Programmer
May 22, 2000
4
0
0
US
I'm trying to include a header that will make sure my images expire from browser cache. I had originally been told to do something like this <br><br>--<br>use CGI::Response qw:)Simple);<br>print &NoCache('image/gif');<br>--<br><br>but that gives me a server error.&nbsp;&nbsp;I've used &quot;use File::Copy&quot; before without any problems, but this doesn't seem to work.<br><br>Since then, I've been trying to manually insert the header, but I am likely doing it wrong.&nbsp;&nbsp;At the bottom is my current test script, but it doesn't yield a valid picture.<br><br>Am I writing the header in the correct way?&nbsp;&nbsp;<br><br>I'm working on a months-long project and this is my last bug.&nbsp;&nbsp;I appreciate any advice that anyone can give me: the more thorough, the better.<br><br>James Sharp - <A HREF="mailto:ecokid@sover.net">ecokid@sover.net</A><br><br>--<br><br>#!/usr/bin/perl5<br><br>require 'CGI_LIB.pl';<br>&Parse_Multi;<br><br>print &quot;Content-type: text/html\n\n&quot;;<br><br>open(TESTPICFILE, &quot;&gt;../testpicheader.gif&quot;);<br>print &quot;HTTP/1.1 200 OK\n\n&quot;;<br>print &quot;$CGI{'testpic.gif'}-&gt;{'Contents'}&quot;;<br>close(TESTPICFILE);
 
I'm sorry, folks.&nbsp;&nbsp;When I was troubleshooting I changed the above script.&nbsp;&nbsp;The one I meant to include follows:<br><br>I hope some of you will still offer some ideas.<br><br>James Sharp - <A HREF="mailto:ecokid@sover.net">ecokid@sover.net</A><br>--<br><br>#!/usr/bin/perl5 <br><br>require 'CGI_LIB.pl'; <br>&Parse_Multi; <br><br>print &quot;Content-type: text/html\n\n&quot;; <br><br>open(TESTPICFILE, &quot;&gt;../testpicheader.gif&quot;); <br>print TESTPICFILE &quot;HTTP/1.1 200 OK\n\n&quot;; <br>print TESTPICFILE &quot;$CGI{'testpic.gif'}-&gt;{'Contents'}&quot;; <br>close(TESTPICFILE);<br><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top