这在PHP中可能也很容易。然而,有3个功能你问这里
- 上传多个文件
- 压缩档案
- 重命名文件
每个人都是不同的解决方案,我的代码可根据需要改变你的变量, 您可以查看详细信息的zip实用程序链接。你也可以像,Zip文件获得职位的数量#2为您的每个任务
PHP ZIP files on the fly
上传多个文件
Upload two files at once
上传
<?
$file_name1 = $_FILES['fsheet']['name'];
$file_name1 = stripslashes($file_name1);
$file_name1 = str_replace("'","",$file_name1);
$copy = copy($_FILES['fsheet']['tmp_name'],$file_name1);
// prompt if successfully copied
if($copy){
echo "$file_name1 | uploaded sucessfully!<br>";
}else{
echo "$file_name1 | could not be uploaded!<br>";
}
$file_name2 = $_FILES['report']['name'];
$file_name2 = stripslashes($file_name2);
$file_name2 = str_replace("'","",$file_name2);
$copy = copy($_FILES['report']['tmp_name'],$file_name2);
// prompt if successfully copied
if($copy){
echo "$file_name2 | uploaded sucessfully!<br>";
}else{
echo "$file_name2 | could not be uploaded!<br>";
}
?>
* *邮编** 首先下载t他从拉链 http://www.phpclasses.org/browse/file/9524.html
<?php
$directoryToZip="secret"; //
$outputDir = $_POST['rootfolder'];
//$outputDir="$folder"; //Replace "/" with the name of the desired output directory.
$zipName="backup.zip";
include_once("zip/CreateZipFile.inc.php");
$createZipFile=new CreateZipFile;
/*
// Code to Zip a single file
$createZipFile->addDirectory($outputDir);
$fileContents=file_get_contents($fileToZip);
$createZipFile->addFile($fileContents, $outputDir.$fileToZip);
*/
//Code toZip a directory and all its files/subdirectories
$createZipFile->zipDirectory($directoryToZip,$outputDir);
$fd=fopen($zipName, "wb");
$out=fwrite($fd,$createZipFile->getZippedfile());
fclose($fd);
$msg = "Files backup successfully";
//$createZipFile->forceDownload($zipName);
$trgtName = date("F-Y-h-i-s"). ".zip";
copy ($zipName,$outputDir."/".$trgtName);
@unlink($zipName);
?>
查找工具类页面的右上角,你看到“搜索”啄? – 2011-05-26 00:09:15