Problem uploading re-zipped package

I'm just starting out thinking about developing but am falling at the very first hurdle. I wanted a quick look inside an H5P package just to get a feel for the territory. Now, here's the thing..

  1. I created a simple activity in the normal way and exported the H5P file.
  2. I changed the H5P suffix to zip and unzipped.
  3. Without changing a thing I rezipped the contents, i.e. not the folder that was created by unzipping but the contents of that folder.
  4. Changed the suffix back to H5P
  5. Tried to upload the activity...and it failed.

I tried uploading to a local installation and to an online installation. The package was rejected. I'm using a mac so used the normal right click to compress and decompress but when that didn't work I also tried WinZip. I wondered if it was a particular Mac problem so this time

 

  1. I created a simple activity in the normal way and exported the H5P file.
  2. I uploaded it as a file to my moodle installation, i.e. just as a file activity not as an H5P activity.
  3. Online within Moodle changed the suffix to zip and unzipped the file online.
  4. Deleted the zip file leaving me with just the unzipped contents.
  5. Selected all the files and downloaded, whereupon they were downloaded as a zip archive.
  6. Changed the suffix of the downloaded archive to H5P
  7. Tried to upload the activity...and it failed.

 

Am I missing something obvious?

otacke's picture

Hi!

 

If you manually zip files, make sure to use the required flags: -D (do not add directory entries) and -X (eXclude eXtra file attributes), e.g. as:

zip -rDX myNewFile.h5p *

H5P expects those flags to be set. BUT zipping manually to create H5P libraries is not recommended anyway. That's what the H5P CLI tool is there for.

Best,
Oliver

Thanks, yes, that's helpful. I had tried half a dozen different ways, a couple locally and several online (as I have discovered Macs don't normally play nicely with zip files). All were failing. Just as I found your reply I did find another way that worked so, in case any other Mac users run into the same issue, what worked for me was using izip which enables you to open a zip file as if it is any other removable drive.

otacke's picture

Building H5P libraries is about more than zipping. I really recommend to familiarize yourself with the H5P CLI tool.