Home >Backend Development >PHP Tutorial >Upload multiple files at once_PHP tutorial
Upload multiple files at once
[img]http://file:///D:/1.jpg[/img]
Please tell me how to implement this type of input that can add or reduce uploaded images at will. Can anyone help me write such a code? And the receiving page must be able to successfully receive the pictures passed here
The best answer [url=http://www.111cn.cn/bbs/space.php?username=E网Xiaoyao]Link tag EwangXiaoyao[/url]
[url=http://www.111cn.cn/bbs/space.php?uid=58710]Link tag[img]http://www.111cn.cn/server/avatar.php?uid=58710&size=small[ /img][/url]
$ScriptName = "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
$mname = "xchngg";
$mpass = "123456";
$mpath = trim($_POST['mpath']);
$Submit = trim($_POST['Submit']);
$action = trim($_GET['action']);
$username = trim($_POST['username']);
$password = trim($_POST['password']);
if($Submit != "" && $mname == $username && $mpass == $password){
if($mpath != "")$mpath = $mpath."/"; //Upload path
foreach($_FILES['fname']['name'] as $key=>$val){ //Array upload file
$fname = $mpath.$val;
if ( $_FILES['fname']['error'][$key]>0 || $_FILES['fname']['size'][$key]==0) {
continue;
}
if (@move_uploaded_file($_FILES['fname']['tmp_name'][$key], $fname)) { //Upload file
$message .="