1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

php zip problem

Discussion in 'PHP' started by flyankur, Nov 15, 2008.

  1. #1
    i am trying to zip some files using on server using php_zip.dll ( php zip) by addFile() function. The problem i am facing is when i give addFile() funtion the arguments of the files added to the ziparchive, the argument has "path" like

    "/xampp/htdocs/ads.txt" then the ziparchive is like

    /xammp/htdocs/ads.txt

    rather then just containing ads.txt only.

    how to stop making these folders and directly store the file in archive

    Also i have files at different places on server i want to zip. then numerous folder will be made. Any help
     
    flyankur, Nov 15, 2008 IP
  2. keyaa

    keyaa Peon

    Messages:
    137
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #2
    addFile has a second parameter "localname". basename() should work great with it.

    instead of
    $zip->addFile($path);
    PHP:
    try
    $zip->addFile($path, basename($path));
    PHP:
     
    keyaa, Nov 15, 2008 IP
  3. Sphinx1994

    Sphinx1994 Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yep, my exact words, that should be perfect.
     
    Sphinx1994, Nov 15, 2008 IP
  4. arnek

    arnek Active Member

    Messages:
    134
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #4
    Agreed!, Please let us know if you got it right.
     
    arnek, Nov 15, 2008 IP