Creating an “unzip” custom module I am creating a website that will allow users to upload projects. Project submissions will consist of .zip file. Once the user uploads their project, I need to unzip the .zip file and find the .html file . Also, it needs to be possible to upload these projects through the web interface "Add New Content" and through Node.create by way of the services module.
note I'm using the PclZip library.
This is part of the code I use when the uploaded file but it does not extract the file


function custom_unzip_node_submit($node, $form, &$form_state) {
    if ($node->type == 'flipper') {
    $p_zipname = base_path() .'sites/default/files'.$form_state["complete form"]["#node"]->field_file["und"][0]["filename"];
    $to_extract = base_path() . 'test/';

    $zip = new PclZip($p_zipname);
    $ar = $zip->extract(PCLZIP_OPT_PATH, $to_extract);

    }
}
Keep in mind Drupal 7 has a built in library for working with archive files.

Archiver Zip

See also system.archiver.inc

Perhaps you'll have more success using that.

Lastly, make sure the path to the uploaded file is correct for extraction.