PHP on the upload of attachments to unzip the problem
In PHP a compressed package upload, I have been able to unzip.
Now how to rename it while extracting it, and put it in another directory?
Please teach the great God.
Unzip the program
$zip = Zip_open ("/php/test/test.zip");
if ($zip) {
while ($zip _entry = Zip_read ($zip)) {
$fp = fopen ("/php/". Zip_entry_name ($zip _entry), ' W ');
if (Zip_entry_open ($zip, $zip _entry, "R")) {
$buf = Zip_entry_read ($zip _entry, zip_entry_filesize ($zip _entry));
Fwrite ($fp, ' $buf ');
Zip_entry_close ($zip _entry);
Fclose ($FP);
}
}
Zip_close ($zip);
}
Ask for the function in the middle plus rename and save to a directory .....
Share to:
------Solution--------------------
Didn't you put it in another catalogue? "/php/". Zip_entry_name ($zip _entry)
If you want to change the file in the package when you unzip it, at least you have to give a change name rule or a new and old name comparison table?
------Solution--------------------
Zip_entry_name ($zip _entry) Gets the file name in the package
You do this with a string function, just generate the target file name.