Community

Unzip a file upon upload via the File field, and auto-create a link to one of the unzipped files

Using Drupal 7. I'm a newb, so go easy on me : (

I am building a site, strictly for learning purposes, that is basically an e-learning course portal.

So I have a content type named 'Course'. The course author role would then create a new Course and in the Course type are numerous fields such as title, description, etc. But also a File upload field that accepts .zip files (this is because most e-learning authoring tools publish to zip format, with the zip containing an index.html and a bunch of .swf files/other .html files and some .js files).

What I'd like to be able to do is:

1. Once the user uploads the zip file, it automatically gets unzipped into a new subdirectory.
2. A link to the 'index.html' file that is in that subdirectory (as it was in the previous .zip package) is then made available and listed in that Course's node page.

I looked for a module that would do this but couldn't find any that fit the bill, and most were not Drupal 7 compatible.

Comments

use hook_node_presave

You will to do some amount of custom code go get this working.

use hook_node_presave and use PHP to unzip the file.
After the file has been unzipped and created, you need to identify if index.html exists.
If it does, go ahead and append a link of the same to the $node->body.

Vaibhav Jain
Tekriti Software

Did you get this going?

Hello!

I'm in the same boat as you, and while the responders comment where no doubt accurate, they were a bit above my skill.

Did you get anywhere with this? If you did, I would love to see how you did it, as must do something exactly like that for a site I've been required to work on.

Cheers
Gord

Reply

Hello ! you are solved this problem? I have a similar problem , Drupal 7 , Commerce-file , and I need upload Zip Journal with index.html and more swf , js files , and set to commerce-file field ://private/journal/newuploaderarchive/index.html. If you realize this , help me plz with this . Thanks and sorry for my bad English :D

nobody click here