title: file upload error "application/octet-stream"
body: <p>I don't really know much PHP. But anyways I am not able to upload a .csv file using the following php. I have fixed the problem with upload_max size related attributes. Works fine on my local but not on sandbox. The error is "application/octet-stream". what should I do?</p>
  
  <p>The data is very simple, stored in .csv format</p>
  
  <pre><code>27589   16990   161.7000095 0.838494
  27589   17067   161.7000095 0.838494
  27820   17144   315.7000095 0.859458
  27820   17221   315.7000095 0.859458
  27820   17606   315.7000095 0.866033
  27820   17683   315.7000095 0.866033
  </code></pre>
  
  <p>Error output: "-- CSV file to load:  Invalid type: application/octet-stream"</p>
  
  <pre><code>&lt;?php
  ini_set('display_errors', 1); error_reporting(E_ALL);
  
  // using upload at click from http://code.google.com/p/upload-at-click/
  // FileData is the name for the input file
  
  $file_result = "";
  $file = $_FILES['Filedata'];
  
  $allowedExtensions = array("csv", "txt");
  $arrayVar = explode(".", $file["name"]);
  $extension = end($arrayVar);
  
  //commented out for strict standard error
  //$extension = end(explode(".", $file["name"]));
  
  
  function isAllowedExtension($fileName) {
      global $allowedExtensions;
      return in_array(end(explode(".", $fileName)), $allowedExtensions);
  }
  
  if($file["error"] &gt; 0){
      echo "failure to upload the file &gt;&gt;&gt; ". "Error code: ".$file["error"]."&lt;br&gt;";
  }else{
      //echo " &gt;&gt;&gt; CURRENT DIR: ".getcwd() . "\n";
      $workDir = getcwd();
  
      $dir = substr($workDir, 0, -10);
      $path = $file["name"];
      $newFileLoc = $dir.$path;
  
      $file_result.=
      "&lt;br&gt;     Upload: " . $file["name"] . "&lt;br&gt;" .
      "     Type: " . $file["type"] . "&lt;br&gt;" .
      "     Size: " . $file["size"] . "&lt;br&gt;" .
      "     file uploaded to: ".$newFileLoc."&lt;br&gt;";
  
      // txt - text/plain
      // rtf - application/msword
      // dat/obj - application/octet-stream
      // csv - application/vnd.ms-excel
      // maximum 200 MB file - 200,000,000 k
  
      if ($file["type"] == "application/vnd.ms-excel" || $file["type"] == "text/plain"){
          if( isAllowedExtension($file["name"]) )
          {
              if( $file["size"] &lt; 200000000 )
              {
                  move_uploaded_file($file["tmp_name"], $newFileLoc);
                  echo "|".$path;//"filePath : " . $newFileLoc;
              }
              else
              {
                  echo "Invalid file size: " . $file["size"] . "\n";   
              }
          }
          else 
          {   
              echo "Invalid extension: " . $file["name"]."\n";
          }
      }
      else
      {
          echo "Invalid type: " . $file["type"] . "\n";
      }
  }
  ?&gt;
  </code></pre>