title: Uploaded files are 0 bytes when uploading from Oculus Quest to LAMP server
body: <p>I am running a LAMP server to collect some data. I have created an Oculus Quest app which collects some data, and then POSTs it to the LAMP server. During my testing of the POST method before deployment on Quest, I was using Unity and Windows. The method works fine, files are uploaded with no issues.</p>
  <p>However when deploying this on the Quest, the file names are uploaded and moved to the target directory, but the files are all 0 bytes.</p>
  <p>I have researched potential issues, and have modified my php.ini file accordingly. I have increased the input time, the max file size, the max file number etc. I have also checked permissions and the error.log files. There are no errors inside there.</p>
  <p>Do you guys have any ideas?</p>
  <p>Unity Code: file_n is an array. It reads in all the filenames from a specific folder in the Quest.</p>
  <pre><code>    IEnumerator UploadFile(string subID)
      {
          UnityWebRequest fileToUpload = new UnityWebRequest();
          WWWForm form = new WWWForm();
  
          fileToUpload = UnityWebRequest.Get(file_n);
          yield return fileToUpload.SendWebRequest();
  
          form.AddField(&quot;sub_ID&quot;, subID);
          form.AddBinaryData(&quot;files[]&quot;, fileToUpload.downloadHandler.data, Path.GetFileName(file_n));
          UnityWebRequest req = UnityWebRequest.Post(hostName, form);
          yield return req.SendWebRequest();
  
          if (req.isHttpError || req.isNetworkError)
          {
              Debug.Log(req.error);
          }
          else
          {
              Debug.Log(req.downloadHandler.text);
              result = req.downloadHandler.text;
              debugText.text = result;
          }
      }
  </code></pre>
  <p>PHP code:</p>
  <pre><code>&lt;?php 
  
  // Include the database configuration file 
  include_once 'configFile.php'; 
       
  // File upload configuration 
  $targetDir = &quot;targetDirectory/&quot;;  
  $allowTypes = array('txt'); 
       
  // variables submitted by user
  $subID = $_POST[&quot;sub_ID&quot;]; 
  
  $statusMsg = $errorMsg = $insertValuesSQL = $errorUpload = $errorUploadType = ''; 
  $fileNames = array_filter($_FILES['files']['name']);
  if(!empty($fileNames)){ 
      foreach($_FILES['files']['name'] as $key=&gt;$val){ 
          // File upload path 
          $fileName = basename($_FILES['files']['name'][$key]); 
          $targetFilePath = $targetDir . $fileName;             
           
          // Check whether file type is valid 
          $fileType = pathinfo($targetFilePath, PATHINFO_EXTENSION); 
          if(in_array($fileType, $allowTypes)){ 
              if(move_uploaded_file($_FILES[&quot;files&quot;][&quot;tmp_name&quot;][$key], $targetFilePath)){ 
                  $insertValuesSQL .= &quot;('&quot; .$subID. &quot;', '&quot;.$fileName.&quot;', NOW()),&quot;; 
              }else{ 
                  $errorUpload .= $_FILES['files']['name'][$key].' | '; 
              } 
          }else{ 
              $errorUploadType .= $_FILES['files']['name'][$key].' | '; 
          } 
      } 
  
      if(!empty($insertValuesSQL)){ 
          $insertValuesSQL = trim($insertValuesSQL, ','); 
           
          $insert = $conn-&gt;query(&quot;INSERT INTO thisTable (sub_ID, file_name, uploaded_on) VALUES $insertValuesSQL&quot;); 
          if($insert){ 
              $errorUpload = !empty($errorUpload)?'Upload Error: '.trim($errorUpload, ' | '):''; 
              $errorUploadType = !empty($errorUploadType)?'File Type Error: '.trim($errorUploadType, ' | '):''; 
              $errorMsg = !empty($errorUpload)?'&lt;br/&gt;'.$errorUpload.'&lt;br/&gt;'.$errorUploadType:'&lt;br/&gt;'.$errorUploadType; 
              $statusMsg = &quot;Files are uploaded successfully.&quot;.$errorMsg; 
          }else{ 
              $statusMsg = &quot;Sorry, there was an error uploading your file.&quot;; 
          } 
      } 
  }else{ 
      $statusMsg = 'Please select a file to upload.'; 
  }      
  // Display status message 
  echo $statusMsg; 
  ?&gt;
  </code></pre>