title: Upload a wav file to server in Unity3d C#
body: <p>I need to upload <code>wav</code> files to a server in c# in unity3d.</p>
  
  <p>I made already a upload system with <code>png</code> files but for some reason it doesn't work with <code>wav</code> files </p>
  
  <p>Here is the image upload script I changed it so it will work with audio but it doesn't work the error I still get is from the php file which says failed</p>
  
  <pre><code>using UnityEngine;
  using System.Xml;
  using System.IO;
  using System.Collections;
  using System.Text;
  
  
  public class Upload : MonoBehaviour
  {
  
  
  
  // Use this for initialization
  void Start () {
  
  }
  
  // Update is called once per frame
  void Update () {
  
  }
  
  void OnGUI()
  {
      GUI.Label(new Rect(100, 0, 500, 20), Application.dataPath);
      if (GUI.Button(new Rect(100, 100, 150, 20), "Upload"))
      {
          UploadFile("http://localhost:8888/unity/upload.php");
      }
  }
  
  IEnumerator UploadFileCo(string uploadURL)
  {
      WWW localFile = new WWW("file:///1.wav");
      yield return localFile;
      WWWForm postForm = new WWWForm();
      postForm.AddBinaryData("file", localFile.bytes, "1.wav");
      WWW upload = new WWW(uploadURL, postForm);
      yield return upload;
      if (upload.error == null)
      {
          Debug.Log(upload.text);
          Debug.Log ("upload error null");
      }
      else
      {
          Debug.Log("Error during upload: " + upload.error);
      }
  }
  
  void UploadFile(string uploadURL)
  {
      StartCoroutine(UploadFileCo(uploadURL));
  }
  
  }
  </code></pre>
  
  <p>Here is the php script</p>
  
  <pre><code>&lt;?php
  $thefile = $_FILES['file'];
  
   if(!empty($theFile))
   {
   echo "Success!";
   }
   else
   {
   echo "Failed!";
   }
   ?&gt;
  </code></pre>