public function validate() {
		if( $this->error ) {
			switch( $this->error ) {
				case UPLOAD_ERR_INI_SIZE:
				case UPLOAD_ERR_FORM_SIZE: {
					throw new UserException('fileTooBig');
					break;
				}
				case UPLOAD_ERR_PARTIAL:
				case UPLOAD_ERR_NO_FILE: {
					throw new UserException('transfertIssue');
					break;
				}
				default: {
					// UPLOAD_ERR_NO_TMP_DIR UPLOAD_ERR_CANT_WRITE UPLOAD_ERR_EXTENSION
					// http://php.net/manual/fr/features.file-upload.errors.php
					log_error("Server upload error (error={$this->error}, name={$this->fileName})", 'Uploading file', false);
					throw new UserException('serverIssue');
				}
			}
		}
		
		if( $this->expectedType !== NULL ) {
			if( $this->getType() !== $this->expectedType ) {
				throw new UserException('invalidType');
			}
		}
		if( $this->allowedExtensions !== NULL ) {
			$ext = $this->getExtension();
			if( $ext === $this->allowedExtensions || (is_array($this->allowedExtensions) && !in_array($ext, $this->allowedExtensions)) ) {
				throw new UserException('invalidExtension');
			}
		}
		if( $this->allowedMimeTypes !== NULL) {
			$mt = $this->getMIMEType();
			if( $mt === $this->allowedMimeTypes || (is_array($this->allowedMimeTypes) && !in_array($mt, $this->allowedMimeTypes)) ) {
				throw new UserException('invalidMimeType');	
			}
		}
	}