GIDForums  

Go Back   GIDForums > Webmaster Forums > Web Design Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 10-Jul-2003, 14:32
shahbaz shahbaz is offline
New Member
 
Join Date: Jul 2003
Location: lahore
Posts: 2
shahbaz is an unknown quantity at this point
Lightbulb

making pdf files downloadable


normally when a visitor clicks on a pdf file the adobe acrobat reader opens it .i have a big file(6 mb) and so i dont want it to be opened while browsing my site ,Rather it should get downloaded properly so reader can use it later on for offline reading ...
what should i do ??
  #2  
Old 10-Jul-2003, 15:31
jrobbio's Avatar
jrobbio jrobbio is offline
Regular Member
 
Join Date: Jan 2003
Location: Loughborough, England
Posts: 840
jrobbio will become famous soon enough
I found exactly what you want here: http://www.aspalliance.com/shark/art...s/DnldDoc.aspx

I don't really know if it just applies to ASP, but give it a look over and see what you think.

Rob
  #3  
Old 10-Jul-2003, 15:36
jrobbio's Avatar
jrobbio jrobbio is offline
Regular Member
 
Join Date: Jan 2003
Location: Loughborough, England
Posts: 840
jrobbio will become famous soon enough
Here's an old one I found to do with PHP

[php]
function download($path)

global $HTTP_USER_AGENT;
$file=basename($path);
$size = filesize($path);
header("Content-Type: application/octet-stream");
header("Content-Type: application/force-download");
header("Content-Length: $size");
// IE5.5 just downloads index.php if we don't do this
if(preg_match("/MSIE 5.5/", $HTTP_USER_AGENT))

header("Content-Disposition: filename=$file");
} else

header("Content-Disposition: attachment;
filename=$file");
}
header("Content-Transfer-Encoding: binary");
$fh = fopen($path, "r");
fpassthru($fh);
}
  #4  
Old 10-Jul-2003, 15:43
jrobbio's Avatar
jrobbio jrobbio is offline
Regular Member
 
Join Date: Jan 2003
Location: Loughborough, England
Posts: 840
jrobbio will become famous soon enough
Ahh here's what we were looking for originally:
http://rtfm.atrax.co.uk/infinitemonk...es/asp/934.asp

<%@Language="JScript"%><%

// forcing download
var objStream = new ActiveXObject("ADODB.Stream");
objStream.Type = 1;
objStream.Open();
objStream.loadFromFile(Server.MapPath("/infinitemonkeys/sources/infinite.pdf"));

Response.ContentType = 'application/unknown';
Response.addHeader('content-disposition', 'attachment;filename=infinite.pdf');
Response.BinaryWrite(objStream.read());

%>
 
 

Recent GIDBlogToyota - 2008 July Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
gxx linker accepts only 7 object files danielxs66 CPP / C++ Forum 1 12-Dec-2003 09:27
Help making a survey in C++ elavalos CPP / C++ Forum 2 23-Sep-2003 16:40
How to create batch files without DOS box? rhino1616 Web Design Forum 3 18-Aug-2003 10:00
[Linux] How to upgrade an rpm with source files? JdS Computer Software Forum - Linux 2 18-Jun-2003 09:17
Dedicated to JDS who does not like flash files jrobbio Open Discussion Forum 9 15-Feb-2003 03:24

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 18:48.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.