LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-10-2016, 11:09 AM   #1
jlarsen
Member
 
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, 11:35 AM   #2
fmattheus
Member
 
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. http://stackoverflow.com/questions/1...-cgi-in-python
 
  


Reply


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-23-2010 12:04 AM
Download all files from a web page chadefa1 Linux - Newbie 2 05-31-2008 09:25 PM
Cant make web server run my local web page... Nik0s Linux - Newbie 22 10-08-2006 11:30 PM
Web page download/backup Hexane Linux - Software 2 01-20-2005 01:40 AM
Jerky mouse when web browsers download web page stodge Linux - Software 1 07-08-2003 11:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:02 AM.

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