我有以下代码:
for($i=0; $i<count($_FILES['upload_obra']['name']); $i++) {
//Get the temp file path
$tmpFilePath = $_FILES['upload_obra']['tmp_name'][$i];
echo $tmpFilePath . " tmpFilePath";
//Make sure we have a filepath
if ($tmpFilePath != ""){
mkdir('images/fotos-geral/' . $ultimoID, 0700);
mkdir('images/fotos-geral/' . $ultimoID . '/obra', 0700);
$newFilePath = 'images/fotos-geral/' . $ultimoID . '/obra/' . $_FILES['upload_obra']['name'][$i];
if(move_uploaded_file($tmpFilePath, $newFilePath)) {
echo "rolou";
//Handle other code here
}
}
}
for($i=0; $i<count($_FILES['upload_doc']['name']); $i++) {
//Get the temp file path
$tmpFilePath = $_FILES['upload_doc']['tmp_name'][$i];
echo $tmpFilePath . " tmpFilePath";
//Make sure we have a filepath
if ($tmpFilePath != ""){
mkdir('images/fotos-geral/' . $ultimoID, 0700);
mkdir('images/fotos-geral/' . $ultimoID . '/doc', 0700);
$newFilePath = 'images/fotos-geral/' . $ultimoID . '/doc/' . $_FILES['upload_doc']['name'][$i];
if(move_uploaded_file($tmpFilePath, $newFilePath)) {
echo "rolou";
//Handle other code here
}
}
}
我的表单中存在两次上传图片。每个都是一个特定的上传。 但是,粘贴不会被创建!上传不会发生。我选择了十张图片,但它没有用。
答案 0 :(得分:0)
您确定要以html格式使用吗?
<form enctype="multipart/form-data"> </form>