Hey!
I am using the following code to upload and extract a ZIP-archive in PHP using CodeIgniter.
$config['upload_path'] = 'backups/';
$config['allowed_types'] = 'zip';
$config['file_name'] = $project_id;
$this->load->library('upload', $config);
if ( file_exists('backups/' . $project_id . '.zip') ) {
try {
delete_file('backups/' . $project_id . '.zip');
} catch (exception $e) {
// do nothing...
}
}
if ( $this->upload->do_upload('zip_archive') ) {
$upload_data = $this->upload->data();
$file_name = 'backups/'.$upload_data['file_name'];
$this->sync_model->extract_zip_archive($project_id, $file_name, TRUE);
echo "Success";
} else {
echo $this->upload->display_errors('<p>','</p>');
}
I get the error though "The filetype you are attempting to upload is not allowed." even though it is a valid .zip file I am uploading. (It's size does not exceed the maximum allowed)
This problem also occurs with every filetype I've tried that's not an image.
Any pointers? Cheers!