File upload size is not even 2MB in PHP -


i want upload image folder image having size less 20kb being uploaded. not able upload file upto 2mb default in php.ini file. have changes values

upload_max_filesize=40m  post_max_size=40m 

i dont know problem is. using 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 less 2mb <h2>";     header( "refresh: 2;url=articlestore.php" ); exit;   }    $parag = nl2br("$descr1");   $query = "insert 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;    }    ?> 

the problem solved. changed

$allowedexts = array("gif", "jpeg", "jpg", "png"); 

to

$allowedexts = array("gif", "jpeg", "jpg", "png","gif","jpeg","jpg","png"); 

now working fine type of images , size greater 2mb


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -