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

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.

Replies are listed 'Best First'.
Re: Re: Re: question about a reply to the Zip::Archive post
by tachyon (Chancellor) on Apr 09, 2004 at 03:18 UTC
    my @path = split '/', $fileToUpload; my filename = $path[-1]; $zip->addString($contents, $filename); print header( -type => 'application/zip', -attachment => "$filename.zip" );

    cheers

    tachyon