473,698 Members | 2,337 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

header download files

Hi,

I have a little problem with the header function. I have a few links to pdf
files on eshop.php.
The links are like this : download.php?pd fid=1

In download.php I get the filename from the database and initiate the
download. If I click on the link, I get the internet explorer dialog box
"open, save or cancel". If I choose save, it correctly saves the file to my
hard drive. But when I choose open, Adobe acrobat says it can't find the
file. What did I do wrong, anyone an idea?

//The code in download.php, I use a static filename in stead of the database
$downfile = "test.pdf";
$rfile = $_SERVER['DOCUMENT_ROOT']."/docs/eshop/prom/".$downfile ;
$filesize=files ize($rfile);
header("Cache-control: private");
header("Content-type: application/pdf");
header("Content-Length: ".$filesize );
header("Content-Disposition: attachment; filename=".$dow nfile);
header("Content-Transfer-Encoding: binary");
$fp = fopen($rfile, 'rb');
$pdf_buffer = fread($fp, $filesize);
fclose ($fp);
print $pdf_buffer;
exit();

//End of code

Thanks in advance!


Jul 17 '05 #1
1 2069
On Fri, 09 Apr 2004 18:39:02 +0200, surfspider wrote:
Hi,

I have a little problem with the header function. I have a few links to pdf
files on eshop.php.
The links are like this : download.php?pd fid=1

In download.php I get the filename from the database and initiate the
download. If I click on the link, I get the internet explorer dialog box
"open, save or cancel". If I choose save, it correctly saves the file to my
hard drive. But when I choose open, Adobe acrobat says it can't find the
file. What did I do wrong, anyone an idea?

There seems to be a couple of problems with IE in combination with the
Acrobat plugin.

See the FAQ of fpdf.org:
3. I try to generate a PDF and IE displays a blank page. What happens?
http://fpdf.ort/en/FAQ.php#3

They give examples of a workaround using JavaScript to redirect to the
PDF-file

Regards,
Henk Burgstra
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2685
by: mr_burns | last post by:
hi, i have been tryin to prompt the download of a file on the server using the following code: // send headers, forcing download: header("Content-type: application/word"); header("Content-Disposition: attachment; filename=\"files/myfile.doc\"");
1
2306
by: Glenn M | last post by:
I have visual c++ 6.0 and i want to use a function (setupuninstalloeminf) in setupapi.h that was not part of the original setupapi.h shipped with vsc++ but was added later. how do i go about getting the newer header file with the newer function on my system. simply copying the header file from my visual c++.net install to the vsc++ install seems to produce errors. do i need to copy across a newer verion of setupapi.lib too, is that...
11
2752
by: Steven T. Hatton | last post by:
In the past there have been lengthy discussiions regarding the role of header files in C++. People have been very adamat about header files serving as in interface to the implementation. I do understand the objective. This example may represent an interface in need of a bit of refactoring, but it goes to demonstrate the basic idea as I understand it. http://developer.kde.org/documentation/library/cvs-api/kdevelop/html/ast_8h-source.html...
7
2347
by: paytam | last post by:
How can I define my own header file?(I use linux,but when I use sine or cosine and etc. I faced to error,so I read the header file but there wasn't any prototype of that functions,so I decided to write my own header file,but I don't know anything about the header files.Please help me)
7
2183
by: ben | last post by:
Hi, I have few doubts about header files. Is it true that header files always have only "function declaration" and not definition? Next where can i find definition of functions defined in system header files. I'm working on UNIX. Thanx in advance.
6
2311
ak1dnar
by: ak1dnar | last post by:
Hi, I am creating script to download some files using download dialog box.First time i tried to use ajax for this, but i failed. So i went through this way, By Using this function i am going to submit the Data to process to PHP. JS Function: function file_down(fid) { window.location = "download.php?fid="+fid; }
2
1322
by: rohini | last post by:
Dear friends, In the popup window i am using the header for downloading the files. I call the popup window in one directory say for example: /sample/download/popup.php In the popup.php i call the function window.open('../export/export.php'); In the export.php i am using the form action as export_type.php. In the export_type.php i includes some file . In that one file contains the function for downloading.
2
1051
by: mlevit | last post by:
I've been getting this error on my website since I first starting making up but I didn't know how to fix it, so I just ended up using HTML redirects to other pages instead of Header("Location:..."). Now I'm trying to retrieve uploaded files from my SQL database and going by the little tutorial from About.com the following file should download my uploaded file. I get the header message because of "Header( "Content-type: $type");". I've...
10
2369
by: jessica87 | last post by:
hi there, i m using this coding to retrieve the file from database so that my user can download the file... <?php if (!isset($_GET)) die('Invalid Parameter'); include 'connectdb.php'; $id = $_GET;
0
8676
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8608
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9161
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8897
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8867
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6522
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.