[英]PHP file uploading script not uploading files
我有这段代码可以上传多个文件。
我可以浏览和选择文件,但不能上传到指定的文件夹。
<span class="btn btn-primary btn-file">
Browse <input name="upload[]" type="file" multiple="multiple" />
</span>
<!-- processing the selected files -->
<?php
for($i=0; $i<count($_FILES['upload']['name']); $i++) {
//Get the temp file path
$tmpFilePath = $_FILES['upload']['tmp_name'][$i];
if ($tmpFilePath != ""){
//Setup our new file path
$newFilePath = "./uploadedFiles/" . $_FILES['upload']['name'][$i];
//move to new path
move_uploaded_file($tmpFilePath, $newFilePath) ;
}
}
?>
这是怎么了
可能是您错过了enctype
<form method="post" enctype="multipart/form-data">
大多数人都忘记了它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.