Hi folks,

This is probably in the realm of the dumb question, but here goes:

I wrote this content management system for a client, who needs all of their files protected (it's basically a restricted extranet). Originally all of the files were protected via apache's .htaccess protocol. Now, I've got a perl based login, and protection via a cookie that I've set, and read when the script is called. Most of the content is generated on the fly by the system with information in a back-end database. However, there are several kinds of files that I want to be able to show/give people access to, that are stumping me.

So these are the scenarios:
1) Regular content - deliverd up via script after cookie check.
2) Flat file html - delivered up via script, gotten from abolute path on the back-end (in an administratively protected area) - read through line by line and printed to the browser.

The ones that I don't know how to do: Images and pdf files, and any other binary file types. I can't send a URL out, because then the user would have to get into the administrative area - which they don't have a password for. How do I send a binary file to the browser from within a script?

Thanks!


In reply to Sending non-html files to a browser through a script by michellem

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.