/    Sign up×
Community /Pin to ProfileBookmark

Create a zipped folder using php?

Not sure if this is possible still a newbie here. I am trying to make a script that will allow people to create there own yahoo messenger skins. A skin consist of a folder filled with .bmp’s and one .xml file.

Trying to figure out how a user will download the folder after they use a form and php creates the folder. Not sure if this is even possible. I know you can use php to create text files but when I try to create a .zip it did but when trying to open it says the file is corrupt.

So my main question is can I use PHP to create a folder that a user can then download?

to post a comment
PHP

8 Comments(s)

Copy linkTweet thisAlerts:
@SpectreReturnsDec 03.2005 — Try searching. This question has been answered a lot (and with solutions too).

I included a quick hackjob to another zip engine to make it a bit more userfriendly.

[upl-file uuid=f7da1a28-ffa8-48a1-8827-9ce8e16d7d3d size=3kB]spectre.zip.zip[/upl-file]
Copy linkTweet thisAlerts:
@ToeBeeauthorDec 03.2005 — sorry about that, figures the one time I dont search the forum... Thanks for the .zip Ill check everything out...
Copy linkTweet thisAlerts:
@ToeBeeauthorDec 03.2005 — ummm, I have tried searching the forums and search engines for more info but cannot find anything...

Also im not sure how to use your attached script. Can anyone point me towards more info on this?
Copy linkTweet thisAlerts:
@purefanDec 03.2005 — http://www.smiledsoft.com/demos/phpzip/index.shtml

check it out, simple and free php ziping ?
Copy linkTweet thisAlerts:
@ToeBeeauthorDec 03.2005 — Thanks I will check it out
Copy linkTweet thisAlerts:
@ToeBeeauthorDec 04.2005 — Thanks purefan ? this is going to work out great. I have a question thou, something my newbie skills cant figure out. I want the user to be able to name there own zipped folder, but I can't seem to pass the varible into where the skins name goes. Im sure this is just a matter of writing it correctly, but having some trouble.

[code=php]<?PHP

$skinname = $_POST['skinname'];

set_time_limit(3000); //for big archives
require("ss_zip.class.php");

// new empty archive with compression level 6
$zip= new ss_zip('',6);

$zip->add_file('skin/test.gif','test.gif');

//Saving the archive to server under a name
$zip->save('$skinname.zip');

?>

<a href="<?php echo $skinname; ?>.zip">download</a>[/code]


This just makes a zipped folder named $skinname.zip. This is probably a true newbie question lol.
Copy linkTweet thisAlerts:
@chazzyDec 04.2005 — try this
[code=php]
$zip->save($skinname.'.zip');
[/code]
Copy linkTweet thisAlerts:
@ToeBeeauthorDec 04.2005 — works great awesome Thanks!
×

Success!

Help @ToeBee 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,
)...