使用PHP生成唯一的文件名?

I am using a php script to upload images to a directory. I am trying to figure out why the script is not giving the images a unique filename before saving them in the directory. I am only uploading one image at a time and I have included the relevant piece of php here which I thought would create unique filenames. Can anyone tell me why the images are not getting unique names?

//proportionally resize image
    private function resize_it(){
        if($this->file_count > 0){
            if(!is_array($this->file_data['name'])){
                throw new Exception('HTML file input field must be in array format!');
            }
            for ($x = 0; $x < $this->file_count; $x++){

                if ($this->file_data['error'][$x] > 0) { 
                    $this->upload_error_no = $this->file_data['error'][$x];
                    throw new Exception($this->get_upload_error()); 
                }   

                if(is_uploaded_file($this->file_data['tmp_name'][$x])){

                    $this->curr_tmp_name = $this->file_data['tmp_name'][$x];
                    $this->get_image_info();

                    //create unique file name
                    if($this->random_file_name){ 
                        $this->new_file_name = uniqid().$this->get_extension();
                        $this->unique_rnd_name[$x] = $this->new_file_name;
                    }else{
                        $this->new_file_name = $this->file_data['name'][$x];
                    }

                    $this->curr_tmp_name = $this->file_data['tmp_name'][$x];
                    $this->image_res = $this->get_image_resource();
                    $this->save_dir = $this->destination_dir;