我有一个表单(
HTML),它将文件提交给
PHP脚本,该脚本将文件重命名为ZIP,将其存储在一个文件夹(随机名称)中,然后提取该文件.
文件上传.
文件夹已正确创建.
该文件被正确重命名.
拉链的提取失败.
这是我的表格:
Select file
这是PHP脚本 – up.php
$file_name = $HTTP_POST_FILES['ufile']['name'];
$random_digit=rand(0000,9999);
$new_file_name=$random_digit.".zip";
mkdir($random_digit, 0777, true);
$path= $random_digit.'/'.$new_file_name;
if($ufile !=none)
{
if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
{
echo "The upload is successful
";
echo "File Renamed to: ".$new_file_name." for processing.
";
echo "File Size :".$HTTP_POST_FILES['ufile']['size']."
";
echo "Proceed to the next phase of the importation of data to the system";
}
else
{
echo "Error";
}
}
$zip = new ZipArchive;
$res = $zip->open($new_file_name);
if ($res === TRUE) {
$zip->extractTo($random_digit.'/');
$zip->close();
echo 'extraction successful';
} else {
echo 'extraction error';
}
它是防止提取的文件夹的模式吗?据我所见,没有语法错误.