Page 1 of 1

uploading compressed files (.zip, .tar, .gzip, etc.)

Posted: Fri May 06, 2005 12:23 am
by siu
I wish to know if there is a way to upload a compressed text file such that as it is uploaded, be able to uncompress it via php and manipulate the text files in order to read data and update database with that data. I came with this when I learned that phpMyAdmin can upload compressed .sql files and then restore a mysql database in seconds. Can anybody give me code examples, etc? Any help will be appreciated.

Posted: Fri May 06, 2005 6:42 am
by John Cartwright
I believe we have a code-snipplet for compressing/de-compressing over at our code snipplet forum.

Posted: Wed May 18, 2005 2:20 pm
by Skara
*bumps topic*

I've searched and searched for some sort of file uncompression. Nada. The only thread I found on these forums is this one.

All I want to do is upload a .tar.gz of photos and uncompress it. Can someone point me in the right direction?

Posted: Wed May 18, 2005 2:30 pm
by Chris Corbyn
Skara,

There's the module ZZipLib for PHP. Then there's also a class ~redmonkey posted in snippets (although I haven't looked at it to check it's for what you need). I guess hotscripts or phpclasses would turn up something too.

BUT, failing those two, you could always just run the unzip command from passthru(), exec() or system() if the only purpose is to physically unzip a file.

Posted: Wed May 18, 2005 2:54 pm
by Skara
yeah, I tried using exec() and got permission denied no matter what I did... 777'd every single file in the neighborhood even. O.o

redmonkey's class is just for zip files, as is ZZipLib, if I'm not mistaken.

Found something on phpclasses, though: http://www.phpclasses.org/browse/package/945.html

^_^

Posted: Wed May 18, 2005 6:27 pm
by Ambush Commander
Sometimes chmodding a file 777 will actually cause it to not work. Try 775.

Posted: Wed May 18, 2005 7:22 pm
by Skara
O.o This is kinda weird. I chdir()'d to the dir and it worked. Weird. Must have been something I did wrong. :P