我見過的其他問題的答案,所以我分開爆炸功能,但仍然給下面的錯誤。我粘貼了文件上傳的整個代碼。誤差in_array檢查圖像的格式
警告:爆炸()預計參數2爲字符串,陣列中的C中給出:\ XAMPP \ htdocs中\ hiddenprocess.php上線22
警告:端()預計參數1是數組,在C空給出:\ XAMPP \ htdocs中\ hiddenprocess.php上線25
下面是代碼:
<?php
if (empty($_FILES['Upload_Property_Images']['name']))
{
echo 'You have\'nt Entered Value for upload field';
}
else
{
foreach($_FILES as $file)
{
// Allowed file types
$whitelist = array("jpg","png");
$temp = explode('.', $file['name']);
// Match uploaded file extension
if (in_array(end($temp), $whitelist))
{
// Count total uploads
if (count($_FILES['Upload_Property_Images']['name'])==6)
{
// Code for uploading here
echo 'files uploaded successfully';
}
else
{
// Count error
echo 'You\'r Only Allowed Six Images';
}
}
else
{
// File extension error
echo 'Your Only Allowed JPG and PNG';
}
}
}
?>
是您的表單輸入名爲'type =「file」name =「Upload_Property_Images」'並且它是否包含'enctype =「multipart/form-data」'?或'name =「Upload_Property_Images []」' - 如果其中任何一個丟失或拼寫錯誤,您的代碼將失敗。 –
雅它包含「ENCTYPE =」多部分/格式數據「也名字是這樣‘名稱=’Upload_Property_Images []」這是我的文件的代碼‘「 – user3610629
另外,你有'method =」post「'? –