 			this._cancelled = false;
 			this._headers = settings.headers;
 			this._mimeType = settings.mime;
+			
+			// make it available for whole class (cancelUpload requires it for example)
+			this._removeAllListeners = removeAllListeners;
 
 			multipart = new Boolean(settings["multipart"]);
 			fileDataName = new String(settings["file_data_name"]);

		}

		public function simpleUpload(url:String, settings:Object):void {
			var file:File = this, request:URLRequest, postData:URLVariables, fileDataName:String, 
				onProgress:Function, onUploadComplete:Function, onIOError:Function, onSecurityErrorEvent:Function,
				
				removeAllListeners:Function = function () : void {
					file._fileRef.removeEventListener(ProgressEvent.PROGRESS, onProgress);
					file._fileRef.removeEventListener(DataEvent.UPLOAD_COMPLETE_DATA, onUploadComplete);
					file._fileRef.removeEventListener(IOErrorEvent.IO_ERROR, onIOError);
					file._fileRef.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityErrorEvent);
				};
			
			file._postvars = settings["multipart_params"];
			file._chunk = 0;

		{
			if (this.canUseSimpleUpload(this._settings)) {
				this._fileRef.cancel();
			} else if (!this._urlStream) {
				// In case of a large file and before _fileRef.load#COMPLETE.
				// Need to cancel() twice, not sure why.
				// If single cancel(), #2037 will occurred at _fileRef.load().
				this._fileRef.cancel();
				this._fileRef.cancel();
				this._removeAllListeners();
			} else if (this._urlStream.connected) {
				// just in case
				this._removeAllURLStreamListeners();

				this._urlStream.close();

				// In case of a large file and after the first uploadNextChunk().
				// #2174 will occur at _fileRef.load() and
				// #2029 will occur at _urlStream.readUTFBytes as well
				// after loading file is stopped before _fileRef.load#COMPLETE.
		
				// Uploaded file will be broken as well if the following line does not exist.
				this._urlStream = null;
			} 
		}

		/**
