PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.general > MIME type
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
MIME type

Réponse
 
LinkBack Outils de la discussion
Vieux 11/09/2007, 16h46   #1
Angelo Zanetti
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut MIME type

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>
  Réponse avec citation
Vieux 12/09/2007, 07h01   #2
heavyccasey@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] MIME type

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
>
>

  Réponse avec citation
Vieux 12/09/2007, 10h08   #3
Angelo Zanetti
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] MIME type

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>
  Réponse avec citation
Vieux 13/09/2007, 13h51   #4
Angelo Zanetti
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] MIME type

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>
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 21h16.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12346 seconds with 12 queries