public static function getTempFile($allow_memory = true) {
    $f = null;

    if ($allow_memory) {
      $f = fopen("php://temp", "rb+");
    }
    else {
      $f = fopen(tempnam(sys_get_temp_dir(), "fnt"), "rb+");
    }

    return $f;
  }
public static function getTempFile($allow_memory = true) {
    $f = null;

    if ($allow_memory) {
      $f = fopen("php://temp", "rb+");
    }
    else {
      $f = fopen(tempnam(sys_get_temp_dir(), "fnt"), "rb+");
    }

    return $f;
  }
public static function getTempFile ( $ allow_memory = true ) { $ f = null ; if ( $ allow_memory ) { $ f = fopen ( "php://temp" , "rb+" ) ; } else { $ f = fopen ( tempnam ( sys_get_temp_dir ( ) , "fnt" ) , "rb+" ) ; } return $ f ; }
Create a temporary file in write mode

@param bool $allow_memory Allow in-memory files

@return resource the temporary file pointer resource
Create a temporary file in write mode