Hướng dẫn php extractto

php-dev at proneticas dot net

11 years ago

If you want to copy one file at a time and remove the folder name that is stored in the ZIP file, so you don't have to create directories from the ZIP itself, then use this snippet [basically collapses the ZIP file into one Folder].



* On a side note, you can also use $_FILES['userfile']['tmp_name'] as the $path for an uploaded ZIP so you never have to move it or extract a uploaded zip file.

Cheers!

ProNeticas Dev Team

Anonymous

4 years ago

If you want to extract the files just to the current folder, simply use
$zip->extractTo["."];

It took me hours to figure this out.

stanislav dot eckert at vizson dot de

7 years ago

The extractTo[] method does not offer any parameter to allow extracting files and folders recursively from another [parent] folder inside the ZIP archive. With the following method it is possible:

Chủ Đề