html5 - File size is not changing for File upload and send email in php -


i'm having problems file uploading. when upload file, seems 1mb in size can uploaded. in code, maximum file size set @ 5mb. if change size, nothing happens. i've check php.ini , maximum allowed size 20mb; post_max_size 20mb. there wrong code?

here's code

<?php   ini_set('display_errors', 1);  $recipientemail = "recruit@neun.ph";  $senderemail = filterinput($_post['email']);    $subject = "application form";     $name = filterinput($_post['name']);     $phone = filterinput($_post['phone']);     $address = filterinput($_post['address']);     $city = filterinput($_post['city']);     $state = filterinput($_post['state']);     $country =  filterinput($_post['country']);     $zipcode = filterinput($_post['zip']);     $position =filterinput($_post['dropdown']);     $portfolio = filterinput($_post['portfolio']);     $message = filterinput($_post['comment']);     $formcontent=" from: $name \n phone: $phone \n address: $address $city     $state $country $zipcode \n position: $position \n portfolio: $portfolio      \n message: $message";     //echo $senderemail.$recipientemail.$message.$subject;            if(sendemailwithattachments($recipientemail,                $senderemail,$subject,$formcontent))      {      echo "email sent successfully!";        }       else         {            echo "failed send email...";          }        function filterinput($data)    {  $data = trim($data);  $data = stripslashes($data);  $data = htmlspecialchars($data);  return $data;      }      function           sendemailwithattachments($recipientemail,                $senderemail,$subject,$formcontent){    if(isset($_files)) {         //echo "iamhere";           $allowedextensions =        array("pdf","doc","docx","gif","jpeg","jpg","jpg","png",               "png","rtf","txt","xml");      $files = array();     foreach($_files $name=>$file) {         //die("file size: ".$file['size']);         if($file['size']>=5242880)//5mb         {             $filesize=$file['size'];             return false;         }         $file_name = $file['name'];          $temp_name = $file['tmp_name'];         $file_type = $file['type'];         $path_parts = pathinfo($file_name);         $ext = $path_parts['extension'];         if(!in_array($ext,$allowedextensions)) {             return false;             die("file $file_name has extensions $ext not         allowed");         }          //move file server, cannot skipped         $server_file="/tmp/$path_parts[basename]";         move_uploaded_file($temp_name,$server_file);         array_push($files,$server_file);         //array_push($files,$temp_name);     }      // email fields     $headers = "from: $senderemail";       // boundary      $semi_rand = md5(time());      $mime_boundary = "==multipart_boundary_x{$semi_rand}x";       // headers attachment      $headers .= "\nmime-version: 1.0\n" . "content-type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\"";       // multipart boundary      $formcontent = "this multi-part message in mime format.\n\n" . "--{$mime_boundary}\n" . "content-type: text/plain; charset=\"iso-8859-1\"\n" . "content-transfer-encoding: 7bit\n\n" . $formcontent . "\n\n";      $formcontent .= "--{$mime_boundary}\n";      // preparing attachments     for($x=0;$x<count($files);$x++){         $file = fopen($files[$x],"rb");         $data = fread($file,filesize($files[$x]));         fclose($file);         $data = chunk_split(base64_encode($data));         $formcontent .= "content-type: {\"application/octet-stream\"};\n" . " name=\"$files[$x]\"\n" .          "content-disposition: attachment;\n" . " filename=\"$files[$x]\"\n" .          "content-transfer-encoding: base64\n\n" . $data . "\n\n";         $formcontent .= "--{$mime_boundary}\n";     }      // send     return @mail($recipientemail, $subject, $formcontent, $headers);  } }      ?> 

and here's html code

<h2>application from</h2>         <form name="myform" action="form.php" method="post"      enctype="multipart/form-data"  >             <label for="name"><span>*</span>name:</label>             <input type="text" name="name" id="name" placeholder="full   name" required /><br />              <label for="email"><span>*</span>email:</label>             <input type="email" name="email" id="email" placeholder="email address" required /><br />              <label for="phone"><span>*</span>phone:</label>             <input type="text" name="phone" id="phone" placeholder="contact number" required /><br />              <label for="file">upload deisgn</label>             <input type="file" name="file" id="file" size="50" required /> <br />              <label for="comment"><span>*</span>comment</label>             <textarea name="comment" placeholder="comment"></textarea>           </div>         </div class="terms">         <div>         <label for="checkbox" name="agree" value="1" /> <h3>by clicking box, declare accept terms , conditions above stated full knowledge of rights under law.</h3>         <input type="checkbox" name="agree" id="checkbox" size="50" required /><br />     <div>            <input type="submit" value="send">         <input type="reset" value="reset"> 

thank help.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -