diff --git a/FileAPI.flash.swf b/FileAPI.flash.swf index cf8df0ef..ecb7b372 100644 Binary files a/FileAPI.flash.swf and b/FileAPI.flash.swf differ diff --git a/flash/src/ru/mail/commands/UploadFileCommand.as b/flash/src/ru/mail/commands/UploadFileCommand.as index 4010684a..18ecf379 100644 --- a/flash/src/ru/mail/commands/UploadFileCommand.as +++ b/flash/src/ru/mail/commands/UploadFileCommand.as @@ -22,6 +22,7 @@ package ru.mail.commands public class UploadFileCommand extends AbstractUploadFileCommand { private var fileRef:FileReference; + private var status:String = null; // httpStatus. in case of upload error we get httpStatus event followed by ioError event. add status to error event using this temp variable public function UploadFileCommand(fileRef:FileReference, url:String, headers:Object, uploadPostData:Object, uploadDataFieldName:String) { @@ -103,7 +104,8 @@ package ru.mail.commands private function onHTTPStatus(event:HTTPStatusEvent):void { trace ("onHTTPStatus", event); - LoggerJS.log("fileReference.upload HTTPStatusEvent: " +event.status) + LoggerJS.log("fileReference.upload HTTPStatusEvent: " +event.status); + status = event.status.toString(); dispatchEvent(new TextEvent("httpStatus", false, false, event.status.toString() ) ); } @@ -120,7 +122,7 @@ package ru.mail.commands LoggerJS.log("fileReference.upload onError: " +event.toString()); trace ("onError", event); - complete(false, null, new ErrorVO(event.toString(), errorType) ); + complete(false, null, new ErrorVO(event.toString(), errorType, status) ); } private function onProgress(event:ProgressEvent):void diff --git a/flash/src/ru/mail/commands/UploadImageCommand.as b/flash/src/ru/mail/commands/UploadImageCommand.as index 9a2bf730..618eec35 100644 --- a/flash/src/ru/mail/commands/UploadImageCommand.as +++ b/flash/src/ru/mail/commands/UploadImageCommand.as @@ -24,6 +24,7 @@ package ru.mail.commands private var _files:Object; private var _totalSize:int = 0; private var _loader:MultipartURLLoader; + private var status:String = null; // httpStatus. in case of upload error we get httpStatus event followed by ioError event. add status to error event using this temp variable public function UploadImageCommand(files:Object, url:String, headers:Object, uploadPostData:Object) { @@ -130,7 +131,8 @@ package ru.mail.commands private function onHTTPStatus(event:HTTPStatusEvent):void { trace ("onHTTPStatus", event); - LoggerJS.log("urlloader.upload onHTTPStatus: " +event.toString()); + LoggerJS.log("urlloader.upload onHTTPStatus: " +event.status); + status = event.status.toString(); dispatchEvent(new TextEvent("httpStatus", false, false, event.status.toString() ) ); } @@ -147,7 +149,7 @@ package ru.mail.commands LoggerJS.log("fileReference.upload onError: " +event.toString()); trace ("onError", event); - complete(false, null, new ErrorVO(event.toString(), errorType) ); + complete(false, null, new ErrorVO(event.toString(), errorType, status) ); } private function onProgress(event:ProgressEvent):void diff --git a/flash/src/ru/mail/controller/AppController.as b/flash/src/ru/mail/controller/AppController.as index a24e3ec4..a4e141ec 100644 --- a/flash/src/ru/mail/controller/AppController.as +++ b/flash/src/ru/mail/controller/AppController.as @@ -597,7 +597,7 @@ package ru.mail.controller if (event.error.error.indexOf("#2038") > -1) { _model.hasError = true; } - _jsCaller.callJS( callback, {type:"error", message:event.error.getError() } ); + _jsCaller.callJS( callback, {type:"error", message:event.error.getError(), status:event.error.httpStatus } ); } uploadCommand.dispose(); diff --git a/flash/src/ru/mail/data/vo/ErrorVO.as b/flash/src/ru/mail/data/vo/ErrorVO.as index ee08713e..2b53b590 100644 --- a/flash/src/ru/mail/data/vo/ErrorVO.as +++ b/flash/src/ru/mail/data/vo/ErrorVO.as @@ -15,14 +15,18 @@ package ru.mail.data.vo public var errorType:String = "error"; public var errorID:String = ""; public var errorMessage:String = ""; + public var httpStatus:String = ''; - public function ErrorVO(error:String, errorType:String = null) + public function ErrorVO(error:String, errorType:String = null, httpStatus:String = null) { super(); parseError(error); if (errorType) { this.errorType = errorType; } + if (httpStatus) { + this.httpStatus = httpStatus; + } } public function parseError(str:String):void { diff --git a/lib/FileAPI.Flash.js b/lib/FileAPI.Flash.js index 40fe0c96..9059cad7 100644 --- a/lib/FileAPI.Flash.js +++ b/lib/FileAPI.Flash.js @@ -1,7 +1,7 @@ /** * FileAPI fallback to Flash * - * @flash-developer "Vladimer Demidov" + * @flash-developer "Vladimir Demidov" */ (function (api, window, document){ api.support.flash = (function (){ @@ -463,7 +463,7 @@ _this.end(evt.status || 200); } else if( type == 'abort' || type == 'error' ){ - _this.end(0, evt.message); + _this.end(evt.status || 0, evt.message); _unwrap(upload); } })