My guess is that the connection timeout for MySQL is too short. I had this same issue and inceased the connection wait timeout parameter and that solved the problem. What you will notice is that smaller video files will upload while large ones get the undefined error.