How to handle multiple file upload using PHP

后端 未结 5 710
-上瘾入骨i
-上瘾入骨i 2020-11-29 07:57

I want to upload files using PHP but the problem is that I don\'t know how many files I will upload.

My question is how can I upload files if I use file[]

5条回答
  •  醉梦人生
    2020-11-29 08:21

    This is a preferred method of mine. It includes a mysql insert to keep a table on the images uploaded. It also moves the image to the admin image folder and copies the image to the user sites image folder.

    "';
            }
            if (move_uploaded_file($_FILES["image"]["tmp_name"][$x],"images/". $image)){
                $messages[] = $image .' uploaded';
            }
            copy("images/".$image, '../images/'.$image);
            mysql_query("INSERT INTO $table_name VALUES ('NULL','$id','images/$image')");
        }
    }
    ?>
    ";}
      ?>
    

提交回复
热议问题