Unzip a file using perl script
Posted on 2003-02-21
I have a CGI script for uploading .zip files, unzipping the file, and then display success message. I am able to upload the zip file to my server. However, I cannot get Perl to unzip the file.
Here is the code snippet:
$output = `unzip $filename 2>&1`;
Here is the ouput I receive:
Archive: test1.zip End-of-central-directory signature not found. Either this file is not a zipfile, or it constitutes one disk of a multi-part archive. In the latter case the central directory and zipfile comment will be found on the last disk(s) of this archive. note: test1.zip may be a plain executable, not an archive unzip: cannot find zipfile directory in one of test1.zip or test1.zip.zip, and cannot find test1.zip.ZIP, period.
Can someone help?