Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^3: Cgi-bin : printing .txt files

by kennethk (Monsignor)
on Jan 07, 2013 at 15:07 UTC ( #1012042=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Cgi-bin : printing .txt files
in thread Cgi-bin : printing .txt files

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.


Comment on Re^3: Cgi-bin : printing .txt files
Select or Download Code
Re^4: Cgi-bin : printing .txt files
by Anonymous Monk on Jan 07, 2013 at 20:05 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1012042]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2014-09-16 01:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (155 votes), past polls