title: How to upload a big file with little php memory?
body: <p>I'm developing a web (html, php, js, mysql) application where users can upload videos to the server, the server stores them in a folder and add an entry into the database.</p>
  
  <p>Is intended to be useful to local tv stations or media producers as a media manager to catalog videos.</p>
  
  <p>The software is intended to be installed on a local server, so you can upload/download big video files in seconds.</p>
  
  <p>The problem is I don't know how to handle such a big upload. I've increased all the settings in my PHP.ini (post_max_size, upload_max_filesize, all scrip-time related and also the script memory_limit to 2G which is the maximum the system allows me to put without crashing.</p>
  
  <p>I can upload files up to 1GB with no problems. Between 1GB and 2GB I get this message:</p>
  
  <pre><code>Warning: POST Content-Length of [filesize] bytes exceeds the limit of 1073741824 bytes in Unknown on line 0
  </code></pre>
  
  <p>Where [filsezize] is the size of the file I'm uploading in bytes.</p>
  
  <p>And with files over 2GB, the upload process terminates when the browser has uploaded 2GB and the error is allways:</p>
  
  <pre><code>Warning: POST Content-Length of 2147483647 bytes exceeds the limit of 1073741824 bytes in Unknown on line 0
  </code></pre>
  
  <p>I think this is happening because the server doesn't have enough memory, but with users possibly uploading 20GB files, adding memory isn't a solution.</p>
  
  <p>Is there a way where I can upload REALLY big files without using much system memory?</p>
  
  <p>EDIT: Even with a different technology. JavaScript can do it? Anything. But as simple as possible.</p>
  
  <p>¿How does YouTube handles his uploads?</p>
  
  <p>The server is a Synology Diskstation so I have lots of disk space but not much cpu or memory.</p>
  
  <p>Thanks! ;)</p>