$ Zip Rename Fonksiyonlar PHP Çalışmıyor

0 Cevap php

PHP bir zip dosyası ayıklama ve content.txt bunu adlandırmak için çalışıyorum. İşte benim kod:

    if($this->copyFile($this->src,$this->dest)) {
        $this->log .= "Successfully copied the file. Starting unzip.<br />";
        $res = $this->zip->open($this->dest);
        if ($res === TRUE) {
            $this->zip->extractTo("/htdocs/content-refresh/");
            $this->extracted = $this->zip->getNameIndex(0);
            $this->log .= "Extracted ".$this->extracted." onto our server.<br />";
            if($this->zip->renameIndex(0,'content.txt')) {
                $this->log .= "Renamed update file to content.txt.<br />";
            } else {
                $this->log .= "Could not rename update file to content.txt.<br />";
            }
            $this->zip->close();
            $this->log .= "The update file is ready to go. Now you can use the update functions.<br />";
        } else {
            $this->log .= "Could not unzip the file.<br />";
        }
    }

Burada dosya çıktı:

Successfully copied the file. Starting unzip.

Extracted Hotel_All_Active 01-19-11.txt onto our server.

Renamed update file to content.txt.

The update file is ready to go. Now you can use the update functions.

Sorun bu dosyayı yeniden adlandırmak olmamasıdır. Ben de denedim:

$this->zip->renameName(strval($this->extracted),'content.txt')

Ama o da dosyayı yeniden adlandırılmış olduğunu yazdırır, ama değil. Burada yanlış bir şey yapıyor, ya da bu fonksiyon adamcağız muyum?

0 Cevap