Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 FLEX中的文件上载不允许文件大小大于1MB_Actionscript 3_Apache Flex_Flex4.5 - Fatal编程技术网

Actionscript 3 FLEX中的文件上载不允许文件大小大于1MB

Actionscript 3 FLEX中的文件上载不允许文件大小大于1MB,actionscript-3,apache-flex,flex4.5,Actionscript 3,Apache Flex,Flex4.5,我正在使用flex和Base64Encoder上传一个文件。但当文件大小超过1MB时,将数据作为参数放在HTTPService上会显示错误。请帮忙。提前谢谢 显示以下错误: 错误:[IOErrorEvent type=“ioError”气泡=false可取消=false eventPhase=2 text=“Error#2032:流错误 我写的函数如下: protected function uploadButton_clickHandler(event:Event):void{

我正在使用flex和Base64Encoder上传一个文件。但当文件大小超过1MB时,将数据作为参数放在HTTPService上会显示错误。请帮忙。提前谢谢

显示以下错误: 错误:[IOErrorEvent type=“ioError”气泡=false可取消=false eventPhase=2 text=“Error#2032:流错误

我写的函数如下:

    protected function uploadButton_clickHandler(event:Event):void{
            try{
                var uniqueRowId:String=parentApplication.dg.dataProvider[parentApplication.dg.selectedIndex].UNIQUEROWID;
                var propObj:Object = parentApplication.propertyDict[uniqueRowId];
                fileRef = propObj["fileRef_"+uniqueRowId];

                fileRef.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA,onUploadComplete);
                fileRef.addEventListener(IOErrorEvent.IO_ERROR,onIOError);

                var selectedAttachment : String = propObj["selectedObjectStr_"+uniqueRowId];
                var UPLOAD_URL:String="/MDOSF/Customer_tab.do"; 
                var ext:String = selectedAttachment.substr(selectedAttachment.lastIndexOf("."), selectedAttachment.length);
                ext = ext.toLowerCase();                    
                var imgByteArr:ByteArray = event.target.data;
                var encoder:Base64Encoder = new Base64Encoder();    
                var totalBytes:uint = imgByteArr.length;
                var limitBytes:String = String((totalBytes/1024)/1024);
                var numericBytes:Number =Number(limitBytes);
                var decimal:String = numericBytes.toFixed(2);
                if(Number(decimal) > 1){
                    //Alert.show("Cannot upload file with size more than 1 MB","Message");
                    //return;
                }
                encoder.encodeBytes(imgByteArr);                    
                var params:Object = new Object();
                params.fileName = encodeURIComponent(selectedAttachment);
                params.ext = ext;
                params.file_data = encodeURIComponent(encoder.flush());
                params.action = "saveAttachment";
                params.GRID_PARAM = "fromGrid";
                params.selectedFile = encodeURIComponent(selectedAttachment);
                params.gridName = parentApplication.fieldName;
                uploadImageService.url = UPLOAD_URL;
                uploadImageService.send(params);

            }catch(err:Error){
            }
        }

大多数web服务器限制
GET
(但服务器可能非常复杂)。默认情况下,。我建议添加:

uploadImageService.method = 'POST';

在调用uploadImageService.send(params)之前,您还需要调整您的Java代码以使用POST方法over GET。

是否
uploadImageService
您的HTTPService?服务器端,您使用什么来处理此请求?您应该增加服务器端的POST限制当我使用以下行发送数据时,它可以正常工作,但在Firefox中除外。有没有解决方案s?
fileRef.upload(new URLRequest(“/MDOSF/Customer_tab.do?action=saveAttachment”);
HTTPService中已经提到了这一点:啊,好吧,我建议对您的原始问题进行编辑,将其包括在内,因为了解问题的范围很重要。