Not signed in (Sign In)

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

  1.  
    Hello,

    We need ZIP upload capability on our site so I followed the instructions to add the ZIP library /lib/pclzip-2-4, and added the code in Changeset 323 (with a slight modification). The ZIP function almost works:

    -I can select a zip file, create a new album, and start uploading the file, but
    -I am redirected to a page with a heading root/trunk/lib/pclzip-2-4/pclzip.lib.php at the midpoint of the page.

    The code in the plog-upload.php file was changed as follows:
    The first change was to add the zip extension to $allowed_exts = array("jpg", "bmp", "gif", "png","zip");
    The second change was to add the code between the // START/END BG ADD headings. Any help to debug the problem would be appreciated.

    Thanks,

    Brian

    Code from updated plog-upload.php file:

    $allowed_exts = array("jpg", "bmp", "gif", "png","zip");

    if ($_FILES["userfile"]["name"] == ""){
    $output .= '<p class="errors">No file name specified!</p>';
    }

    // BEGIN BG ADD Changeset 323 code
    [the first line below is not the same as 323 code but matches the code elsewhere in the 2.1 script which has no $pi variable]
    else if ($filename_ext == "zip") {
    // let's decompress the zip file into the uploads folder and then redirect
    // the user to plog-import.php
    include('../lib/pclzip-2-4/pclzip.lib.php');

    //zip file to extract
    $archive = new PclZip($_FILES["userfile"]["tmp_name"]);

    //extract to uploads folder
    if ($archive->extract(PCLZIP_OPT_REMOVE_ALL_PATH, PCLZIP_OPT_PATH,$config["basedir"].'uploads/') == 0)
    {

    //failed
    $output .= '<p class="errors">Error:'.$archive->errorInfo(true).'</p>';
    }
    else
    {
    // unzip succeeded, let's redirect to the import interface.
    header("location:plog-import.php?directory=bda1146671668d77b2da21c84146056a");
    }
    }
    // END BG ADD Changeset 323 code

    else if (!in_array($filename_ext, $allowed_exts))
    {
    $output .= '<p class="errors">Not a valid image file!</p>';
    }