title: PHP | File upload, modification of data inside $_FILES
body: <p>I have a HTML Form which deals with uploading files.</p>
  
  <p>I use the PHP variables <code>$_FILES</code> (<code>name, type, error, size, tmp_name</code>) to store the values in my database and also validate the uploaded file.</p>
  
  <p>I do most validations fine by checking mime types and what not. However when it comes to checking the size of the document, after research I have heard that the user can easily modify the content of <code>$_FILES["size"]</code> and make a fake value inside there.</p>
  
  <p>This is a problem for my website as i am planning on restricting certain users to <code>20MB upload</code> and higher ranked members to uploading a max of 100mb, and so on...So of course it is problematic if a regular user tricks the code to saying the size is lower then 20mb, whereas the file could actually be over 20MB.</p>
  
  <p>So the question is, how do i tackle this sittuation and check the file size properly?</p>
  
  <p>Note, i cannot use <code>getimagesize()</code> since the files being uploaded are not images.</p>