You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@royale.apache.org by GitBox <gi...@apache.org> on 2020/11/11 14:45:39 UTC

[GitHub] [royale-asjs] piotreky opened a new issue #930: mx.net.FileReference - the 'size' property returns -1

piotreky opened a new issue #930:
URL: https://github.com/apache/royale-asjs/issues/930


   Built for the target 'JSRoyale'.
   For the selected file, the 'name' property is correct, but the 'size' property returns -1.
   
   If I'm correct, the responsible code is in org.apache.royale.file.beads.FileModel.as:
   
   		public function get size():Number
   		{
   			COMPILE::SWF 
   			{
   				return _data.size;
   			}
   			COMPILE::JS 
   			{
   				return blob ? blob.length : -1;
   			}
   		}
   
   It seems that something is wrong with the '_blob' property.
   
   Any ideas?
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [royale-asjs] piotrzarzycki21 commented on issue #930: mx.net.FileReference - the 'size' property returns -1

Posted by GitBox <gi...@apache.org>.
piotrzarzycki21 commented on issue #930:
URL: https://github.com/apache/royale-asjs/issues/930#issuecomment-725479787


   Please share code how are you using this class. It would be best if it is compiled small example. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [royale-asjs] piotreky commented on issue #930: mx.net.FileReference - the 'size' property returns -1

Posted by GitBox <gi...@apache.org>.
piotreky commented on issue #930:
URL: https://github.com/apache/royale-asjs/issues/930#issuecomment-725539144


   Here is a small test application:
   
   `<?xml version="1.0" encoding="utf-8"?>
   <mx:Application 
   	xmlns:fx="http://ns.adobe.com/mxml/2009"
   	xmlns:mx="library://ns.apache.org/royale/mx" 
   	width="100%"
   	horizontalAlign="center"
   	layout="vertical"
   	backgroundColor="white" 
   	creationComplete="init();">
   
       <fx:Script>
   	<![CDATA[
           import mx.controls.Alert;
   		import mx.net.FileReference;
   		import mx.net.FileFilter;
           import org.apache.royale.events.Event;
   
   	    private var fileRef:FileReference;
   		private var excelFilter:FileFilter = new FileFilter("Excel", "*.xls;*.xlsx"," XLBN ,XLS_;XLS3;XLS4");
   		private var csvFilter:FileFilter = new FileFilter("Comma Separated Values (*.csv)","*.csv","CSV");
   		private var tabFilter:FileFilter = new FileFilter("Tab-delimited Files (*.txt)","*.txt","TXT");
   
   	    private function init():void {
   	        fileRef = new FileReference();
   	        fileRef.addEventListener(Event.SELECT, fileRef_select);
   	    }
   
   	    private function browseAndUpload():void {
   	        fileRef.browse([excelFilter, csvFilter, tabFilter]);
   	    }
   	
   	    private function fileRef_select(evt:Event):void {
   	        try {
   				Alert.show("Hello: "+fileRef.name+ " of size " + fileRef.size);
   	        } catch (err:Error) {
   	            Alert.show("ERROR: zero-byte file");
   	        }
   	    }
   	
   	]]> 
   	</fx:Script>
   
   	<mx:Button label="Select file" click="browseAndUpload();"/>
   
   </mx:Application> 
   `


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org