|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi guys.
I am linking to a file on a WAP site. the backend is written in PHP. However I need to link to a file but set the content type. I've done the following and am wondering if this is correct: <? // We'll be outputting a PDF header('Content-type: application/vnd.symbian.install'); // It will be called downloaded.pdf header('Content-Disposition: attachment; filename="../File/norEnglish.sis"'); ?> So basically I set the HREF to the file above (filename .php). Let me know if there is anything that im doing incorrectly. Thanks -- ------------------------------------------------------------------------ Angelo Zanetti Systems developer ------------------------------------------------------------------------ *Telephone:* +27 (021) 552 9799 *Mobile:* +27 (0) 72 441 3355 *Fax:* +27 (0) 86 681 5885 * Web:* http://www.zlogic.co.za *E-Mail:* angelo@zlogic.co.za <mailto:angelo@zlogic.co.za> |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Look up readfile();
Make sure you read the comments. On 9/11/07, Angelo Zanetti <angelo@zlogic.co.za> wrote: > Hi guys. > > I am linking to a file on a WAP site. the backend is written in PHP. > However I need to link to a file but set the content type. I've done the > following and am wondering if this is correct: > > <? > > // We'll be outputting a PDF > header('Content-type: application/vnd.symbian.install'); > > // It will be called downloaded.pdf > header('Content-Disposition: attachment; > filename="../File/norEnglish.sis"'); > > ?> > > > So basically I set the HREF to the file above (filename .php). > > Let me know if there is anything that im doing incorrectly. > > Thanks > > -- > ------------------------------------------------------------------------ > Angelo Zanetti > Systems developer > ------------------------------------------------------------------------ > > *Telephone:* +27 (021) 552 9799 > *Mobile:* +27 (0) 72 441 3355 > *Fax:* +27 (0) 86 681 5885 > * > Web:* http://www.zlogic.co.za > *E-Mail:* angelo@zlogic.co.za <mailto:angelo@zlogic.co.za> > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Thanks heavyccasey
Im not sure which comment you are referring to, perhaps this one? There are many posts. |<?php $file = '/var/www/html/file-to-download.xyz'; header('Content-Description: File Transfer'); header('Content-Type: application/force-download'); header('Content-Length: ' . filesize($filename)); header('Content-Disposition: attachment; filename=' . basename($file)); readfile($file); ?>| heavyccasey@gmail.com wrote: > Look up readfile(); > > Make sure you read the comments. > > On 9/11/07, Angelo Zanetti <angelo@zlogic.co.za> wrote: > >> Hi guys. >> >> I am linking to a file on a WAP site. the backend is written in PHP. >> However I need to link to a file but set the content type. I've done the >> following and am wondering if this is correct: >> >> <? >> >> // We'll be outputting a PDF >> header('Content-type: application/vnd.symbian.install'); >> >> // It will be called downloaded.pdf >> header('Content-Disposition: attachment; >> filename="../File/norEnglish.sis"'); >> >> ?> >> >> >> So basically I set the HREF to the file above (filename .php). >> >> Let me know if there is anything that im doing incorrectly. >> >> Thanks >> >> -- >> ------------------------------------------------------------------------ >> Angelo Zanetti >> Systems developer >> ------------------------------------------------------------------------ >> >> *Telephone:* +27 (021) 552 9799 >> *Mobile:* +27 (0) 72 441 3355 >> *Fax:* +27 (0) 86 681 5885 >> * >> Web:* http://www.zlogic.co.za >> *E-Mail:* angelo@zlogic.co.za <mailto:angelo@zlogic.co.za> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> >> > > -- ------------------------------------------------------------------------ Angelo Zanetti Systems developer ------------------------------------------------------------------------ *Telephone:* +27 (021) 552 9799 *Mobile:* +27 (0) 72 441 3355 *Fax:* +27 (0) 86 681 5885 * Web:* http://www.zlogic.co.za *E-Mail:* angelo@zlogic.co.za <mailto:angelo@zlogic.co.za> |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
GOt it working by adding the MIME type to the .htaccess file on the server.
Angelo Zanetti wrote: > Thanks heavyccasey > > Im not sure which comment you are referring to, perhaps this one? > There are many posts. > > |<?php > $file = '/var/www/html/file-to-download.xyz'; > header('Content-Description: File Transfer'); > header('Content-Type: application/force-download'); > header('Content-Length: ' . filesize($filename)); > header('Content-Disposition: attachment; filename=' . basename($file)); > readfile($file); > ?>| > > heavyccasey@gmail.com wrote: >> Look up readfile(); >> >> Make sure you read the comments. >> >> On 9/11/07, Angelo Zanetti <angelo@zlogic.co.za> wrote: >> >>> Hi guys. >>> >>> I am linking to a file on a WAP site. the backend is written in PHP. >>> However I need to link to a file but set the content type. I've done >>> the >>> following and am wondering if this is correct: >>> >>> <? >>> >>> // We'll be outputting a PDF >>> header('Content-type: application/vnd.symbian.install'); >>> >>> // It will be called downloaded.pdf >>> header('Content-Disposition: attachment; >>> filename="../File/norEnglish.sis"'); >>> >>> ?> >>> >>> >>> So basically I set the HREF to the file above (filename .php). >>> >>> Let me know if there is anything that im doing incorrectly. >>> >>> Thanks >>> >>> -- >>> ------------------------------------------------------------------------ >>> >>> Angelo Zanetti >>> Systems developer >>> ------------------------------------------------------------------------ >>> >>> >>> *Telephone:* +27 (021) 552 9799 >>> *Mobile:* +27 (0) 72 441 3355 >>> *Fax:* +27 (0) 86 681 5885 >>> * >>> Web:* http://www.zlogic.co.za >>> *E-Mail:* angelo@zlogic.co.za <mailto:angelo@zlogic.co.za> >>> >>> -- >>> PHP General Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >>> >>> >> >> > -- ------------------------------------------------------------------------ Angelo Zanetti Systems developer ------------------------------------------------------------------------ *Telephone:* +27 (021) 552 9799 *Mobile:* +27 (0) 72 441 3355 *Fax:* +27 (0) 86 681 5885 * Web:* http://www.zlogic.co.za *E-Mail:* angelo@zlogic.co.za <mailto:angelo@zlogic.co.za> |
|
![]() |
| Outils de la discussion | |
|
|