File downloaded from server is corrupted on MAC

I make a script to upload file to S3 Amazon.I use this code to upload the file on S3

if (S3::putObject(S3::inputFile($file), $bucket, $uri, S3::ACL_PUBLIC_READ)){ 
        echo "File Uploaded";}

And download that file with this code

Read More
 $filE=fopen('filename.zip', 'a');
    if($s3->getObject($bucket, $aws_object,$filE))

    {
    echo "File dowloaded successfully"
    fclose($filE);

    }

This file comes in server.From here i tried to download that file from server using these headers.

        $filename=basename($file);
        header("Cache-Control: public");
        header("Content-Description: File Transfer");
        header("Content-Disposition: attachment; filename=$filename");
        header("Content-Type: application/zip");
        header("Content-Transfer-Encoding: binary");
        readfile($file);

On windows file is opening proerly.But when i try to download that file on Mac .File downloaded succesfully but file name is appended with some unknown extension.supoose file name is “testing.zip”,But when it download that file on MAC system the file name becomes this “testing.zip.cpgz”.
I am very much worried about this.Can somebody help me.I will be very thankful to him.

Related posts