Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

To quote Archive::Zip,

One of the most common ways to use Archive::Zip is to generate Zip files in-memory
I generally find dealing with tmp files in a web context is messier than doing this all in memory, but that's my two cents and not the question you asked.

The directory creation problem is likely an issue with file permissions. From a web security perspective, I think that limitation makes a lot of sense, but if your server admin is comfortable with what you want to do, you should be able to accomplish this by modding whatever use your web server runs with (apache, perhaps) to have write privileges in /var/www/html or whatever yours is.

Rather than taking your approach, and assuming you are committed to doing this via redirect instead of just simple streaming, I would create the files in question in the /tmp directory and then provide a link to a script whose whole function is opening the file (name passed in the query string). Again, this has web security problems, since a naive implementation gives a bad person access to read your entire file system. Note you will have to also implement some kind of cache cleaning behavior in a separate script, probably via cron job.

#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

In reply to Re^3: Cgi-bin : printing .txt files by kennethk
in thread Cgi-bin : printing .txt files by teddyttas

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and the fire pops...

    How do I use this? | Other CB clients
    Other Users?
    Others imbibing at the Monastery: (3)
    As of 2018-05-23 00:27 GMT
    Find Nodes?
      Voting Booth?