Sending default code back to browser
I'm not sure how this would work, but I'm guessing it's possible...
I have a Perl script that retrieves one of either two types of files, gifs
and pdfs. It works well. The URL specifices which gif or pdf is to be
returned. The script finds the file on the server, opens it, and sends it
to the user's browser window.
My problem is when the user specifies a file that doesn't exist. Because of
the nuances of Internet Explorer, if the user used a URL to view a PDF, the
next time that user uses that same url, a PDF is expected by IE to be
returned. If I try to return HTML text saying, "Sorry, file not found", IE
has trouble rendering it since it isn't a PDF this time. So what I'd like
to do is return a "default" PDF or GIF in the event that the file isn't
found. I don't want to create a default PDF or GIF file though. In other
words, I'd like to hardcode the GIF or PDF info in the Perl script.
Is this as easy as opening a PDF in a text editor, copying the code, and
pasting it into a Perl Print statement (making sure to send the appropriate
content headers of course)? When I open a GIF in a text editor, I get some
pretty weird looking Hex code, so I didn't know if this approach would work.
Re: Sending default code back to browser
> My problem is when the user specifies a file that doesn't exist.
> Because of the nuances of Internet Explorer, if the user used a URL
> to view a PDF, the next time that user uses that same url, a PDF is
> expected by IE to be returned. ...
Do you have a Perl question?
|All times are GMT. The time now is 03:58 PM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.