View Full Version : unzip

SeeIT Solutions
11-22-2006, 09:48 AM
I'm trying to unzip a .zip file that is uploaded through a normal form.

I am on a shared server running PHP 4. I've tried using this

$zip = new ZipArchive;
if ($zip->open($_FILES['images']['tmp_name']) === TRUE) {
echo 'ok';
} else {
echo 'failed';

It is uploading fine.

I get a class non-existent error
Fatal error: Cannot instantiate non-existent class: ziparchive

I know what that means, I just don't know how to install it on a shared server with no SSH access.

Is it possible or is there another way?

SeeIT Solutions
11-22-2006, 10:22 AM
would it be possible to use exec()? if so, what paramaters should I pass?

11-22-2006, 10:38 AM
just upload the class file, and add a line like this to the beginning of your code:

include 'ZipArchive.class.php';

or whatever file that contains the class...

that's all there is to it, unless I'm misunderstanding the problem...

SeeIT Solutions
11-22-2006, 11:25 AM
There is no class file, the downloads for the ZZiplib are all c files and makefiles.


11-22-2006, 12:25 PM
Methinks you need to talk to your hosting provider, and see if they'll install it for you.

And you might be able to use exec(), but I don't know enough shell to help you there...

SeeIT Solutions
11-22-2006, 01:03 PM
I always seem to solve my own problems on here :(

the zip_open, zip_read, zip_entry_open etc functions work, but not on files that have been uploaded, they have to be saved to the server first then read from there.

11-22-2006, 01:26 PM
I always seem to solve my own problems on here :(

That's not really a bad thing! :D Glad you sorted it out...

SeeIT Solutions
11-22-2006, 01:38 PM
Ha, I guess it's not, I'm also glad I sorted it out, I have a meeting with my client in the morning and it's 11pm.