Login   Register  
PHP Classes
elePHPant
Icontem

meta-inf folder not getting created

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      EPub  >  All threads  >  meta-inf folder not getting created  >  (Un) Subscribe thread alerts  
Subject:meta-inf folder not getting created
Summary:meta-inf folder with container.xml is not found
Messages:2
Author:Ashesh Bharadwaj
Date:2012-06-05 15:21:26
Update:2012-06-06 04:13:16
 

  1. meta-inf folder not getting created   Reply   Report abuse  
Picture of Ashesh Bharadwaj
Ashesh Bharadwaj
2012-06-05 15:21:26
I am not able to load the epub in iPad. When I unzipped the epub file using winrar, it is showing this error:

Cannot create META-INF\container.xml
The system cannot find the path specified.

After the unzip operation the folder only contains a 0 byte META-INF file.

I isolated the following code and tested it using PHPZip class but still the same error:

$zip->addDirectory("META-INF//");

$content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<container version=\"1.0\" xmlns=\"urn:oasis:names:tc:opendocument:xmlns:container\">\n\t<rootfiles>\n\t\t<rootfile full-path=\"book.opf\" media-type=\"application/oebps-package+xml\" />\n\t</rootfiles>\n</container>\n";

$zip->addFile($content, "META-INF/container.xml");

  2. Re: meta-inf folder not getting created   Reply   Report abuse  
Picture of Ashesh Bharadwaj
Ashesh Bharadwaj
2012-06-06 04:13:16 - In reply to message 1 from Ashesh Bharadwaj
Thanks Asbjorn Grandt for this wonderful class. After fixing the issue, it worked like a charm :)

I fixed the issue by commeting the following lines in ePub.php.

//$this->zip->addDirectory("META-INF//");

It seems there is no need to add the "META-INF" directory seperately. The addFile() with META-INF in path does the job: