使用php和html输入标记上载200多个图像
我正在尝试用php上传多个图像文件。我编辑了php.ini并将upload_max_files设置为20000。但它一次只能上传200个图像。任何帮助都将被告知 这是我的密码使用php和html输入标记上载200多个图像,php,Php,我正在尝试用php上传多个图像文件。我编辑了php.ini并将upload_max_files设置为20000。但它一次只能上传200个图像。任何帮助都将被告知 这是我的密码 if(isset($_FILES['files'])){ $count=0; foreach ($_FILES['files']['tmp_name'] as $key => $tmp_name){ $target="upload/photo/"; $target=$target.$_FILES['
if(isset($_FILES['files'])){ $count=0; foreach ($_FILES['files']['tmp_name'] as $key => $tmp_name){
$target="upload/photo/";
$target=$target.$_FILES['files']['name'][$key];
$partphoto = substr("$target", 13, -4);
$qq="select * from idol_student_photo where name='$partphoto'";
$res=mysql_query($qq);
$row=mysql_fetch_array($res);
if(file_exists($target))
{
echo $_FILES['files']['name'][$key]." already exists in photo folder <br />";
}
else if($row['name'])
{
echo $partphoto." already exists database <br />";
}
else
{
if(move_uploaded_file($tmp_name, $target)){
//$id = mysql_insert_id($con);
mysql_query("INSERT INTO tablename VALUES ('$partphoto')");
$count=$count+1;
}
}
}
echo "<center>".$count."file uploaded</center>";
}
if(isset($\u FILES['FILES']){$count=0;foreach($\u FILES['FILES']['tmp\u name']作为$key=>$tmp\u name){
$target=“上传/photo/”;
$target=$target.$_文件['FILES']['name'][$key];
$partphoto=substr(“$target”,13,-4);
$qq=“选择*来自偶像\学生\照片,其中姓名='$partphoto';
$res=mysql\u查询($qq);
$row=mysql\u fetch\u数组($res);
如果(文件_存在($target))
{
echo$_FILES['FILES']['name'][$key]。“已存在于照片文件夹中
”;
}
else if($row['name']))
{
echo$partphoto。“已存在数据库
”;
}
其他的
{
if(移动上传的文件($tmp\U名称,$target)){
//$id=mysql\u insert\u id($con);
mysql_查询(“插入到tablename值(“$partphoto”)”;
$count=$count+1;
}
}
}
回显“%$count.”上载的文件;
}
这可能是PHP的限制。所以我们真的帮不了你。然而;大多数PHP系统都有zip函数。因此,检测客户端验证中是否有太多图片,并向用户建议使用zip方法。我还没有测试过这段代码,但应该会让你找到正确的方向
$zip = zip_open("/tmp/youruploaded.zip");
$target="upload/photo/";
if ($zip) {
while ($zip_entry = zip_read($zip)) {
$zipfilename = zip_entry_name($zip_entry);
$target=$target.$zipfilename;
$partphoto = substr("$target", 13, -4);
$qq="select * from idol_student_photo where name='$partphoto'";
$res=mysql_query($qq);
$row=mysql_fetch_array($res);
if(file_exists($target)) {
echo $zipfilename." already exists in photo folder <br />";
} else if($row['name']) {
echo $zipfilename." already exists database <br />";
} else{
$buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
if (file_put_contents($target, $buf)) {
mysql_query("INSERT INTO tablename VALUES ('$partphoto')");
$count=$count+1;
} else {
echo 'can\'t put picture';
}
}
}
zip_close($zip);
}
$zip=zip\u open(“/tmp/yourupload.zip”);
$target=“上传/photo/”;
如果($zip){
而($zip\u entry=zip\u read($zip)){
$zipfilename=zip\u条目\u名称($zip\u条目);
$target=$target.$zipfilename;
$partphoto=substr(“$target”,13,-4);
$qq=“选择*来自偶像\学生\照片,其中姓名='$partphoto';
$res=mysql\u查询($qq);
$row=mysql\u fetch\u数组($res);
如果(文件_存在($target)){
echo$zipfilename。“已存在于照片文件夹中
”;
}else if($row['name'])){
echo$zipfilename。“已存在数据库
”;
}否则{
$buf=zip_entry_read($zip_entry,zip_entry_filesize($zip_entry));
如果(文件内容)($目标(千美元){
mysql_查询(“插入到tablename值(“$partphoto”)”;
$count=$count+1;
}否则{
echo“无法放置图片”;
}
}
}
zip_close($zip);
}
祝你好运嘿,我不会回答你的问题,但我想警告你,你很容易受到sql注入的攻击。请仔细阅读它们,否则你很可能会遭到野蛮的黑客攻击。为什么?现代PHP系统禁用了多个语句。所以他们只能插入你不想要的东西。这并不是那么残忍…在你的php.ini max_文件上传中设置这些值,post_max_sizeal也可以尝试使用uploadify这样的插件。对不起,伙计,应该是file_get_contents swaning:zip_read():5在C:\wamp\www\test1\upload.php中不是有效的zip目录资源,显示了这一点并警告:file_get_contents(uphoto)[function.file get contents]:无法打开流:权限被拒绝此警告。您知道必须首先处理上载,对吗?Mate,所以不仅仅是一个writemscript.com网站……所有上传的图像都是1KB的,并且没有正确显示