> 
> Hi,
> 
> I have files(.jpg, .pdf, .rtf, .xls) in the following non-public folder:
> 
> /home/alex/documents/
> 
> I need to show these files (jpg), or allow the download (.pdf, .rtf
...) from a script for users who already are authenticated and have a
session opened in the server (this part is already working).
> 
> that I can do?
> 
> thanks in advance, 
> 

This can be handled just as a normal CGI script is, but when you print a
header you will want to print the header of the type of file rather than
'text/html'... Generally I would have the filename of the desired file
passed as a parameter, then within your script you have the following
steps: 

1. check the permissions
2. retrieve the filename
3. check that it exists in your storage directory
4. determine a header based on the filetype or extension (etc.)
5. open the file (possibly in binmode)
5. print the appropriate header
6. print the file (again in binmode).

Does this get you going? Come back if you get stuck....

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to