我有一个表单(
HTML),它将文件提交给
PHP脚本,该脚本将文件重命名为ZIP,将其存储在一个文件夹(随机名称)中,然后提取该文件.
拉链的提取失败.
这是我的表格:
<form action="up.PHP" method="post" enctype="multipart/form-data" name="form1" id="form1"> Select file <input name="ufile" type="file" id="ufile" size="50" /> <input type="submit" name="Submit" value="Upload" /> </form>
$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<BR/>"; echo "File Renamed to: ".$new_file_name." for processing.<BR/>"; echo "File Size :".$HTTP_POST_FILES['ufile']['size']."<BR/>"; echo "<strong><a style='color:#6A8DBC; text-decoration:none' href='".$link_address."'>Proceed to the next phase of the importation of data to the system</a></strong></br>"; } 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'; }