Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 02-10-2016, 10:09 AM   #1
Registered: Jan 2005
Location: Dallas, TX
Distribution: Slackware 14.1
Posts: 79

Rep: Reputation: 15
Make private document available for download through web page after login

There is a program in cgi-bin (written in C) that generates the html pages the user sees after they log in. The program creates various files (zip, PDF, etc) and makes them available for download. These are sensitive documents and can not be put in a public area for download.

It is possible to create a PDF in a non public directory then write the file to stdout and it displays the PDF in the browser. However, when trying to do the same with a zip file the contents of the file are displayed in the browser - as if the zip file had been opened with a text editor.

It seems there must be a common way to handle this issue since banks and other institutions allow you download statements and other private documents. However, I seem to be using the wrong search terms and can't find anything except for a possible PHP solution. Maybe it is as simple as somehow telling the browser what to do with the file?

Thanks in advance for any advice.
Old 02-10-2016, 10:35 AM   #2
Registered: Nov 2015
Posts: 104

Rep: Reputation: 38
before you print out the contents of the file, you need to set the content type header, which in this case should be application/octet-stream.

See this link for ideas.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about uploading a document into field web page - using google chrome joreg_ Linux - Software 0 11-22-2010 11:04 PM
Download all files from a web page chadefa1 Linux - Newbie 2 05-31-2008 08:25 PM
Cant make web server run my local web page... Nik0s Linux - Newbie 22 10-08-2006 10:30 PM
Web page download/backup Hexane Linux - Software 2 01-20-2005 12:40 AM
Jerky mouse when web browsers download web page stodge Linux - Software 1 07-08-2003 10:29 PM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:53 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration