应该是图片的多重上传表单
我得到了上传表单的 HTML 代码:
<form action="upload.php" method="post" id="uploadform" name="uploadform" enctype="multipart/form-data">
<label id="filelabel" for="fileselect">Choose the Pictures</label>
<input type="file" id="fileselect" class="fileuplaod" name="uploads[]" multiple />
<span class="text">Exist Album</span><br />
<select id="existAlbum" name="existAlbum" size="1">
<option value="noAlbum">SELECT ALBUM</option>
</select>
<span class="text">OR</span>
<span class="text">New Album</span><br />
<input id="newAlbum" name="newAlbum" type="text" maxlength="20" placeholder="ALBUM NAME"/>
<input type="submit">
</form>
upload.php 的表单链接。但我得到:
Notice: Undefined index: existAlbum in E:\xampp\htdocs\fotokurs\upload\upload.php on line 11
Notice: Undefined index: newAlbum in E:\xampp\htdocs\fotokurs\upload\upload.php on line 12
这是upload.php:
<?PHP
$allowedExtensions = array('png', 'jpg', 'jpeg');
$maxSize = 20971520;
$i = 0;
$first = 0;
$exist_album = $_POST['existAlbum'];
$new_album = $_POST['newAlbum'];
我的错在哪里?我找不到它...
编辑 在我的代码中添加以下内容:
if( isset( $_POST['existAlbum'] ) or isset( $_POST['newAlbum'] ) ){
$exist_album = $_POST['existAlbum'];
$new_album = $_POST['newAlbum'];
}else{
echo 'no album <br />';
}
print_r($_POST);
新输出:
no album
Array ( )
Notice: Undefined variable: new_album in E:\xampp\htdocs\fotokurs\upload\upload.php on line 20
Notice: Undefined variable: exist_album in E:\xampp\htdocs\fotokurs\upload\upload.php on line 21
Notice: Undefined variable: new_album in E:\xampp\htdocs\fotokurs\upload\upload.php on line 22
Notice: Undefined variable: exist_album in E:\xampp\htdocs\fotokurs\upload\upload.php on line 23