title: How to send large file size i.e more than 1 MB through AJAX POST Request?
body: <p>I am trying to implement upload file through PHP and jquery ajax. I am able to do so for small files, however, when I try to upload large files it is showing "Unknown Error".
  My jquery code :</p>
  
  <pre><code>var data = {
      data: self.parent().prev().find('img').attr('image_data'),
  };
  $.ajax({
              url: 'banner_data/upload_remove_files',
              type: 'POST',
              data: data,
              dataType: "json",
              success: function(data) {
                  if (data.msg != 'error' &amp;&amp; self.hasClass('remove_class')) {
                      alert('File Uploaded');
                  },
                  error: function() {
                      alert('Unknown error occurred');
                  }
              });
  </code></pre>
  
  <p>My PHP code:</p>
  
  <pre><code>if (!empty($_POST['data'])) {
      $file_location = $_SERVER['SERVER_NAME'].
      '/pathname';
      $file_name = !empty($_POST['name']) ? $_POST['name'] : '';
      list($type, $raw_data) = explode(';', $_POST['data']);
      list(, $raw_data) = explode(',', $raw_data);
      $raw_data = base64_decode($raw_data);
      if (file_put_contents($file_location.$file_name, $raw_data) === FALSE) {
          $msg = 'error';
      }
  }
  print json_encode(array(
      'msg' =&gt; $msg,
      'file_name' =&gt; $file_name
  ));
  </code></pre>
  
  <p>The <strong>post_max_size</strong> variable value is 100 MB. So, that is not the issue.
  If the issue is in the payload limit exceeding for a POST Request, then how to tackle the same?</p>