title: How to get the size of a binary data posted to a php?
body: <p>My 3rd party app creates an image and store it in a variable and then post it to a php on the server. for security matters, I need to limit the upload size. Now that the binary data is not written to a file yet, how would I go around getting its size? </p>
  
  <p>Here is the code:</p>
  
  <pre><code>&lt;?php
  
  $_data = $_POST['data']; //get the binary data from the client side.
  
      if($_data !=""){
         $handle = fopen($_path."/".$_ref.".png", "w");
         fwrite($handle,$_data);
      }
  
  ?&gt;
  </code></pre>