File uploads occasionally result in empty files

I have a fairly standard file upload form and I am getting occasional empty files. I tested uploads using the exact same file and 1 or 2 out of 10 uploads are coming thru as empty files. At first I was getting mimeType validation errors but after debugging realized that they are actually 0 byte files. I added the fileSize validation rule to catch them but Im still concerned why this happens. I am mostly noticing it on iPad, uploading files in either Safari or Chrome from Google Docs. I dont seem to have this problem on my desktop. Below is some info about my environment…

PHP 5.3.3
CakePHP 2.8.3

Thanks for any thoughts and suggestions.

Hello. I also had this problem, while I was adding file upload functionality (yesterday). 0byte files - or better - 0 byte in db entity ans no file on the server actually are caused by exhausting the max_upload_size in php.ini and/or the upload limit at the reverse proxy like nginx. Call
Phpinfo and check the upload and/or memory limit. This solved my problem. On my todo is a check fit that and throwing an exception. Hope that helps.

Ah, and also check the max_execution_time. Could be possible that the script ends prematurely, because the execution time is reached.

Thanks TheMiller although I dont think that is the problem. These are small pdf files and I dont have a problem uploading them from my desktop. The problem only occurs on my iPad when I upload them from Google Drive and it only happens 1-2 times out of 10. Unfortunately this is the preferred method for some users.

My memory limit is 1.5G and my post_max_size is 8M and my upload_max_filesize is 5M. I am under the threshold on all of these (most of my testing was with a 29 KB file). My max_execution_time is 12000 and my upload and error happens fast.

I am wondering if it has something to do with the file not fully transferring to the tmp location before the validation happens.