/    Sign up×
Community /Pin to ProfileBookmark

creating ZIP files

I have installed PEAR ArchiveZip and I have it working.

However, when I examine my archive, I see the paths are all wrong.

It gives me loads of directories before I get to my files, like this:

C:wampwwwmysitepdfdirfile.pdf

I cant figure out how to prevent it doing that – any ideas? I just want the pdfs in the root of the archive.

I am using the tutorial here:
[url]http://builder.com.com/5100-6371_14-6125204.html[/url]

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@NightShift58Mar 12.2007 — When calling the "create()" method, add 'remove_all_path' to the parameters you are passing to it.[code=php]if ($obj->create($files,'remove_all_path')) {
echo 'Created successfully!';
} else {
echo 'Error in file creation';
}[/code]
Copy linkTweet thisAlerts:
@mameha1977authorMar 12.2007 — if ($obj->create($in_files, 'remove_all_path')) {

...When I try that I get the 'error in file creation' message.


if ($obj->create($in_files)) {

...If I go back to the simple one it works again.

I didn't touch anything in the original zip.php file.
Copy linkTweet thisAlerts:
@NightShift58Mar 12.2007 — I took another look at the documentation. It's still no clear to me, but it may be expecting an array as parameter. If that the case, this could work: [code=php]$ZIPparam = array("remove_all_path");
if ($obj->create($files,$ZIPparam)) {
echo 'Created successfully!';
} else {
echo 'Error in file creation';
}[/code]
Copy linkTweet thisAlerts:
@mameha1977authorMar 12.2007 — Tried that but again I get the error. Im wondering if I need to pass it an array and the 4th entry has that value...
Copy linkTweet thisAlerts:
@mameha1977authorMar 12.2007 — Fixed with this:

$ZIPparam = array('no_compression' => false,
'add_path' => "",
'remove_path' => "",
'remove_all_path' => TRUE);

if ($obj->create($in_files, $ZIPparam)) {


...

Thanks for your help!
Copy linkTweet thisAlerts:
@mameha1977authorMar 12.2007 — moved to new thread...
×

Success!

Help @mameha1977 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.4,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...