title: Retrieve original uploaded filename using php on OpenShift
body: <p>I would like to check that a file uploaded to my OpenShift app has a text extension (.txt or .tab). Following some advice <a href="https://stackoverflow.com/questions/10456113/php-check-file-extension-in-upload-form">given here</a> I wrote the following code, with echoes added to help debug:</p>
  <pre><code>$AllowedExts =  array('txt','tab');
   echo &quot;AllowedExts: &quot; . $AllowedExts[0] . &quot; and &quot; . $AllowedExts[1] . &quot;&lt;br&gt;&quot;;
  $ThisPath = $_FILES['uploadedfile']['tmp_name'];
   echo &quot;ThisPath: &quot; . $ThisPath . &quot;&lt;br&gt;&quot;;
  $ThisExt = pathinfo($ThisPath, PATHINFO_EXTENSION);
   echo &quot;ThisExt: &quot; . $ThisExt . &quot;&lt;br&gt;&quot;;
  if(!in_array($ThisExt,$AllowedExts) ) {
      $error = 'Uploaded file must end in .txt or .tab';
  }
   echo &quot;error echo: &quot; . $error . &quot;&lt;br&gt;&quot;;
  </code></pre>
  <p>On uploading any file, the echoed response was:</p>
  <blockquote>
  <p>AllowedExts: txt and tab</p>
  <p>ThisPath: /var/lib/openshift/************/php/tmp/<em><strong>phpSmk2Ew</strong></em></p>
  <p>ThisExt:</p>
  <p>error echo: Uploaded file must end in .txt or .tab</p>
  </blockquote>
  <p>Does this mean that OpenShift is renaming the file upon upload? How do I get the original filename and then check its suffix? More generally, is there a better way to check the file type?</p>