Welcome Guest, Not a member yet? Register   Sign In
zip library CRC32 error
#1

[eluser]Unknown[/eluser]
I am getting an error with my zip files when I try to zip following code

Controller
Code:
//gets the zipname and the projectDir to send to the downloadZip function
    public function downloadZip() {


        $zipName = $this->project_model->getProjectTitle($this->uri->segment(3));
        $projectDir = $this->project_model->getProjectPath($this->uri->segment(3));


        $this->doDownload($projectDir, $zipName);
    }

    //Does sends all projects to the downloadZip function
    public function downloadAllProjects() {

        if ($_SESSION['isAdmin'] != true) {
            redirect('user');
        }
        $projectDir = '/projects/';

        $zipName = 'project.zip';
        $this->doDownload($projectDir, $zipName);
    }

    /**
     * Reads the projectdir and then returns a zip , which you download with the zipname
     * @param type $projectDir
     * @param type $zipName
     */
    private function doDownload($projectDir, $zipName) {
        $this->load->library('zip');
        $this->zip->read_dir($projectDir, FALSE);

        // Download the file to your desktop. Name it "after the name given"
        $this->zip->download($zipName);
    }

Module
Code:
/**
     * Gets the project's path and returns it as a string
     * @param type $id
     * @return string
     */
    public function getProjectPath($id) {
        $record = $this->getDetails($id);

        foreach ($record->result() as $row) {

            $projectDir = '/projects/' . $row->location . '/' . $row->fase . '/' . $row->title . '/';
        }

        return $projectDir;
    }

    public function getProjectTitle($id) {
        $record = $this->getDetails($id);

        foreach ($record->result() as $row) {

            $projectTitle = $row->title;
        }

        return $projectTitle;
    }

The download all projects works like a charm. The real problem comes when I zip a specific project. I get the files in the zip but the crc is 00000000 with every file. This is problem occurs when I run it on my ubuntu server but not on my local machine.

Any idea how I can fix this?




Theme © iAndrew 2016 - Forum software by © MyBB