PHP Excel plug-in use Couldnotclosezipfileuploadfiles/EasyA

Source: Internet
Author: User
Tags php excel
The PHPExcel plug-in used by CouldnotclosezipfileuploadfilesEasyA in the CI framework can be used on the server (previously written by someone else), but the same code cannot be used locally, the following error occurs:
Fatal error: Uncaught exception 'exception' with message' Could not close zip file uploadfiles/easyadreport-5590e7006ebed-fixed location schedule -201507221012316xlsx. 'In D: \ svn \ smartAd \ trunk \ application \ libraries \ PHPExcel \ Writer \ Excel2007.php: 380 Stack trace: #0 D: \ svn \ smartAd \ trunk \ application \ controllers \ report \ query. php (915): PHPExcel_Writer_Excel2007-> save ('uploadfiles/Eas... ') #1 [internal function]: Query-> Excel () #2 D: \ svn \ smartAd \ trunk \ system \ core \ CodeIgniter. php (359): call_user_func_array (Array, Array) #3 D: \ svn \ smartAd \ trunk \ index. php (294): require_once ('d: \ svn \ smartAd \... ') #4 {main} thrown in D: \ svn \ smartAd \ trunk \ application \ libraries \ PHPExcel \ Writer \ Excel2007.php on line 380
How can I solve this problem? the win7 system used


Reply to discussion (solution)

Fatal error: Uncaught exception 'exception' with message' Could not close zip file
Fatal error: uncaptured exception message "the ZIP file cannot be closed

Maybe your virus firewall opened your file

1. permission issues
2. Chinese name problems

Fatal error: Uncaught exception 'exception' with message' Could not close zip file
Fatal error: uncaptured exception message "the ZIP file cannot be closed

Maybe your virus firewall opened your file



My only firewall, Symantec Endpoint Protection, has been disabled and stopped. I cannot restart my computer.

1. permission issues
2. Chinese name problems



The Chinese name can be downloaded on the server... Read the folder permissions of my project, read, write, modify, and execute permissions are all available.


1. permission issues
2. Chinese name problems



The Chinese name can be downloaded on the server... Read the folder permissions of my project, read, write, modify, and execute permissions are all available.


Do Users or everyone have read and write permissions?

Today, my team lead finally helped me find the answer. The problem here is due to a problem that occurred during the export process. it is not found in linux, however, in windows, if the exported data is in gbk format and the exported data contains Chinese characters, a pop-up cannot be closed, and garbled characters should be disabled. Correct code: save method

$path='uploadfiles/';                $output['url']=$path.'EasyADReport-'.$args['plan'].'-'.mb_convert_encoding($arrPlan['name'],'gbk','UTF-8').'-'.date('YmdHis').'.xlsx';                $output['url1']=$path.'EasyADReport-'.$args['plan'].'-'. $arrPlan['name'].'-'.date('YmdHis').'.xlsx';                                $objWriter=PHPExcel_IOFactory::createWriter($this->phpexcel,'Excel2007');                $objWriter->save($output['url']);                //$output['url']=$this->config->config['base_url'].$output['url'];                $output['url']=$this->config->config['base_url']. $output['url1'];

Generally, gbk is used in windows, and the second line is better to be replaced:

$output['url']=$path.'EasyADReport-'.$args['plan'].'-'.((strtolower(substr(PHP_OS,0,3))=='win') ? mb_convert_encoding($arrPlan['name'],'gbk','UTF-8') : $arrPlan['name']).'-'.date('YmdHis').'.xlsx';

Http://bbs.csdn.net/topics/391079330

Generally, gbk is used in windows, and the second line is better to be replaced:

$output['url']=$path.'EasyADReport-'.$args['plan'].'-'.((strtolower(substr(PHP_OS,0,3))=='win') ? mb_convert_encoding($arrPlan['name'],'gbk','UTF-8') : $arrPlan['name']).'-'.date('YmdHis').'.xlsx';



Thank you very much. I learned another trick !!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.