I followed lemon juices suggestion (no offense chejug, but isn’t JavaScript not to reliable as it can be turned off?)
So, Heres what im getting
Warning: explode() expects parameter 2 to be string, array given in /home/fixmy1/public_html/masterasp/providers/thanks.php on line 42
Warning: end() expects parameter 1 to be array, null given in /home/fixmy1/public_html/masterasp/providers/thanks.php on line 42
Invalid file
Warning: explode() expects parameter 2 to be string, array given in /home/fixmy1/public_html/masterasp/providers/thanks.php on line 42
Warning: end() expects parameter 1 to be array, null given in /home/fixmy1/public_html/masterasp/providers/thanks.php on line 42
Invalid file
Warning: explode() expects parameter 2 to be string, array given in /home/fixmy1/public_html/masterasp/providers/thanks.php on line 42
Warning: end() expects parameter 1 to be array, null given in /home/fixmy1/public_html/masterasp/providers/thanks.php on line 42
Invalid file
Warning: explode() expects parameter 2 to be string, array given in /home/fixmy1/public_html/masterasp/providers/thanks.php on line 42
Warning: end() expects parameter 1 to be array, null given in /home/fixmy1/public_html/masterasp/providers/thanks.php on line 42
Invalid file
Warning: explode() expects parameter 2 to be string, array given in /home/fixmy1/public_html/masterasp/providers/thanks.php on line 42
Warning: end() expects parameter 1 to be array, null given in /home/fixmy1/public_html/masterasp/providers/thanks.php on line 42
Invalid file[B]
but this is what happens when I
echo "<pre>";
print_r($_FILES);
echo "</pre>";
[/B]
<pre>Array ( [file] => Array ( [name] => Array ( [0] => logo.gif [1] => [2] => [3] => signs.png [4] => [5] => ) [type] => Array ( [0] => image/gif [1] => [2] => [3] => image/png [4] => [5] => ) [tmp_name] => Array ( [0] => /tmp/phpyIfS3A [1] => [2] => [3] => /tmp/phpBDNY6b [4] => [5] => ) [error] => Array ( [0] => 0 [1] => 4 [2] => 4 [3] => 0 [4] => 4 [5] => 4 ) [size] => Array ( [0] => 6258 [1] => 0 [2] => 0 [3] => 91631 [4] => 0 [5] => 0 ) ) ) </pre>
heres the foreach loop
foreach ($_FILES["file"] as $file) {
$allowedExts = array("jpg", "jpeg", "gif", "png");
$extension = end(explode(".", $_FILES["file"]["name"]));
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/png")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 200000)
&& in_array($extension, $allowedExts))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br>";
echo "Type: " . $_FILES["file"]["type"] . "<br>";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>";
if (file_exists("uploads/" . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " already exists. ";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"uploads/" . $_FILES["file"]["name"]);
echo "Stored in: " . "uploads/" . $_FILES["file"]["name"];
}
}
}
else
{
echo "Invalid file";
}
}