in reply to question about a reply to the Zip::Archive post

What you are seeing in the browser IS the zip file. The PK blah bit is the standard zip header - have a look at a zip file with a text editor.

Anyway the reason you see the file as a text file is because you script is not sending a header your browser understands or your browser does not know how to deal with application/zip MIME type and defaults to text. Depending on how you look at it.

Change the header type sent by your script to 'application/octet-stream' and it should work fine. If not get a decent browser. What are you using?

cheers

tachyon

  • Comment on Re: question about a reply to the Zip::Archive post

Replies are listed 'Best First'.
Re: Re: question about a reply to the Zip::Archive post
by Anonymous Monk on Apr 08, 2004 at 03:55 UTC
    You were totally right, tachyon, thank you so much for your help! And to answer your question, I am using IE 6.0.2800... . I tried this out and it works PERFECTLY, so thanks so much for your help!

    ++ for you!

Re: Re: question about a reply to the Zip::Archive post
by Anonymous Monk on Apr 09, 2004 at 03:02 UTC
    I ran into another problem that a few hours trying to debug wouldn't help. M problem is the files I'm including are not in the same dirctory as the script. A my $fileToUpload = 'foobar.txt'; runs perfectly and as expected if the file is inside the same folder. I tried my $fileToUpload = "/home/spanky/public_html/scripts/upload/images/VwImg.jpg"; and it doesn't work. It doesn't work because it has the / in the file name $fileToUpload. So I tried changing the attachment to -attachment => "test.zip" and it inserts an empty folder.

    Do you have any advice how I would include files from other directories?

    Thank you for all your help.

      my @path = split '/', $fileToUpload; my filename = $path[-1]; $zip->addString($contents, $filename); print header( -type => 'application/zip', -attachment => "$filename.zip" );

      cheers

      tachyon