What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » PHP & IE using headers to add file as an attachment...

PHP & IE using headers to add file as an attachment...
Author: Message:
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
O.P. PHP & IE using headers to add file as an attachment...
Ok so I have a situation and it is confusing me as this works fine in Firefox.

PHP code:
<?
    $path = '/home/ss/plsc/';
    $f = scandir( $path );
    rsort ( $f );
 
    $file = '/home/ss/plsc/'.$f[0];
    header("Pragma: public");
    header("Expires: 0");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Cache-Control: public");
    header("Content-Description: File Transfer");
    header("Content-Type: application/zip");
    header("Content-Disposition: attachment; filename=\"".basename($file)."\"");
    header("Content-Transfer-Encoding: binary");
    header('Content-Length: ' . filesize($file));
    readfile($file);
?>


I have the above code. This simply grabs the last PLSC built on the server for download. There are no problems at all in Firefox. However in IE you end up with a PLSC that inside has the PLSC again without an extension... I also added the mime type using .htaccess

[Image: attachment.php?pid=984168]

I am at a loss...

.jpg File Attachment: ie_downloaded_plsc.jpg (57.74 KB)
This file has been downloaded 234 time(s).

This post was edited on 01-08-2010 at 04:18 PM by matty.
01-08-2010 04:07 PM
Profile E-Mail PM Find Quote Report
Mnjul
forum super mod
******

Avatar
plz wub me

Posts: 5396
Reputation: 58
– / Other / Flag
Joined: Nov 2002
Status: Away
RE: PHP & IE using headers to add file as an attachment...
It appears that your plsc file is actually tar-gzipped, not zipped. How did you compress to make the plsc file?

This post was edited on 01-08-2010 at 04:18 PM by Mnjul.
01-08-2010 04:18 PM
Profile PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
O.P. RE: PHP & IE using headers to add file as an attachment...
quote:
Originally posted by Mnjul
It appears that your plsc file is actually tar-gzipped, not zipped. How did you compress to make the plsc file?
I used a PHP Zip library. That file inside the zip you see is a ZIP without an extension. IE downloaded it as a GZIP Firefox downloads it as a ZIP.
01-08-2010 04:22 PM
Profile E-Mail PM Find Quote Report
Mnjul
forum super mod
******

Avatar
plz wub me

Posts: 5396
Reputation: 58
– / Other / Flag
Joined: Nov 2002
Status: Away
RE: PHP & IE using headers to add file as an attachment...
Hmm. :-/

Try adding a
Content-Encoding: gzip
header.
01-08-2010 04:34 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On