title: How to reject file upload before php saves it?
body: <p>As i understand PHP saves file to temporary directory and after that i can work with the file through $_FILES.</p>
  
  <p>I need to check fe things BEFORE PHP starts downloading the file - if the session is valid, if referrer is valid... so i can prevent saving rubbish to the php temporary directory by unauthorised uploaders.</p>
  
  <p>it is any way how to do that?</p>
  
  <p>i know how to do that nicely in perl but i'm looking for pure php solution without php.ini modifications or .htaccess modifications.</p>