![]() |
|
#1
|
|||
|
|||
making pdf files downloadablenormally 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
|
||||
|
||||
|
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
|
||||
|
||||
|
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
|
||||
|
||||
|
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 GIDBlog
Toyota - 2008 July Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
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