I want to upload image to the some folder but only image having size less than 20Kb are only being uploaded. I am not able to upload even file upto 2Mb as it is by default in php.ini file. I have changes the values for
upload_max_filesize=40M
post_max_size=40M
I dont know what the problem is. I am using a Xammp server
<?php
include_once("connect.php");
session_start();
if(isset($_POST['subm']))
{
extract($_POST);
$_SESSION['artsubmit_error'] = "";
$title1 = $_POST['title'];
$intro1 = $_POST['intro'];
$descr1 = $_POST['descr'];
$imgname= $_FILES["file"]["name"];
$artid = "".$_SESSION['logged_user_email']."";
$allowedExts = array("GIF", "JPEG", "JPG", "PNG");
$temp = explode(".", $_FILES["file"]["name"]);
$extension = end($temp);
echo "$extension";
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/jpg")
|| ($_FILES["file"]["type"] == "image/pjpeg")
|| ($_FILES["file"]["type"] == "image/x-png")
|| ($_FILES["file"]["type"] == "image/png"))
&& ($_FILES["file"]["size"] < 10000000)
&& in_array($extension, $allowedExts))
{
if(!is_dir("Article/".$artid.""))
{ mkdir("Article/".$artid.""); }
mkdir("Article/".$artid."/".$title1."");
move_uploaded_file($_FILES["file"]["tmp_name"],"article/".$artid."/".$title1."/".$_FILES["file"]["name"]."");
}
else
{
print "<br> ".$_FILES["file"]["type"]."";print "<br>";
print "<h2>Invalid image. File should be less than 2MB <h2>";
header( "refresh: 2;url=articlestore.php" ); exit;
}
$parag = nl2br("$descr1");
$query = "insert into article values('','$userid','$title1','$intro1','$parag','$imgname',NOW())";
mysql_query($query) or die("unsucessfull");
$_SESSION['artsubmit_error'] = "Article submitted. Post another";
header("Location: articlestore.php" );exit;
}
?>