You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Matthew Weir <ma...@yahoo.com> on 2014/01/31 20:34:45 UTC

Mac FileReference Bug

Hey all,

Stuck using Flex 3.x on this particular project and apparently Mac Safari and Firefox don't fire off the Event.SELECT event.
Unresolved bug file: https://bugbase.adobe.com/index.cfm?event=bug&id=3687113

I'm restricting file extensions, file size etc on the client side and that's when I'm running that validation (after file is selected and before upload attempt).

Can any of you think of an alternative prior to me moving that validation logic to the server side after the upload attempt??

Thanks,

Matthew

Re: Mac FileReference Bug

Posted by Matthew Weir <ma...@yahoo.com>.
The bug is definitely browser specific.  Mac chrome works, PC chrome, FF, IE, and Safari work just fine.

The bug was filled by someone else years ago and from what I can gather online is at least through flex 3.9

The code logic is very simple.  Forgive me if it comes out Not perfect, on a phone and going by memory.

Private function onUploadClick():void
{
   Fileref.addEventListener(Event.SELECT, onSelect);
   Fileref.browse();
  // file browser opens in ALL browsers 
   // I believe file browser is AIR related based on documentation, but I'm not sure
    // bug exists even when FP is updated to 12.x
}

Private function onSelect(ev:Event):void
{
    // code is reached by all browsers
    // but Mac FF and Mac Safari
}

Sent from Yahoo Mail on Android


Re: Mac FileReference Bug

Posted by OmPrakash Muppirala <bi...@gmail.com>.
The bug is filed against AIR, whereas he seems to be having issues with FP
in the browser.
On Feb 2, 2014 9:53 PM, "jude" <fl...@gmail.com> wrote:

> In the bug he mentioned there's a code but that may not be his. In that
> example though, the handler is setup like so,
>
> protected function onModelSelected(e:Event):void {
>   var fr:FileReference = e.currentTarget as FileReference;
>   fr.addEventListener(Event.COMPLETE, onModelDone);
>   fr.addEventListener(ProgressEvent.PROGRESS, onProgress);
>   // trace("loading...");
>   // setTimeout(function():void {fr.load()}, 1);//this will work
>   fr.load(); //this won't
>   trace("loading2...");
> }
>
> In the code above the file reference may be garbage collected before the
> complete event is fired. I think that when he uses the setTimeout he's
> keeping a reference to file around long enough for the event to be
> dispatched.
>
>
> On Sun, Feb 2, 2014 at 6:30 PM, OmPrakash Muppirala <bigosmallm@gmail.com
> >wrote:
>
> > On Jan 31, 2014 11:35 AM, "Matthew Weir" <ma...@yahoo.com> wrote:
> > >
> > > Hey all,
> > >
> > > Stuck using Flex 3.x on this particular project and apparently Mac
> Safari
> > and Firefox don't fire off the Event.SELECT event.
> > > Unresolved bug file:
> > https://bugbase.adobe.com/index.cfm?event=bug&id=3687113
> > >
> > > I'm restricting file extensions, file size etc on the client side and
> > that's when I'm running that validation (after file is selected and
> before
> > upload attempt).
> > >
> > > Can any of you think of an alternative prior to me moving that
> validation
> > logic to the server side after the upload attempt??
> > >
> > > Thanks,
> > >
> > > Matthew
> >
> > Posting a code snippet would be useful to help debug your problem
> >
> > Thanks,
> > Om
> >
>

Re: Mac FileReference Bug

Posted by jude <fl...@gmail.com>.
In the bug he mentioned there's a code but that may not be his. In that
example though, the handler is setup like so,

protected function onModelSelected(e:Event):void {
  var fr:FileReference = e.currentTarget as FileReference;
  fr.addEventListener(Event.COMPLETE, onModelDone);
  fr.addEventListener(ProgressEvent.PROGRESS, onProgress);
  // trace("loading...");
  // setTimeout(function():void {fr.load()}, 1);//this will work
  fr.load(); //this won't
  trace("loading2...");
}

In the code above the file reference may be garbage collected before the
complete event is fired. I think that when he uses the setTimeout he's
keeping a reference to file around long enough for the event to be
dispatched.


On Sun, Feb 2, 2014 at 6:30 PM, OmPrakash Muppirala <bi...@gmail.com>wrote:

> On Jan 31, 2014 11:35 AM, "Matthew Weir" <ma...@yahoo.com> wrote:
> >
> > Hey all,
> >
> > Stuck using Flex 3.x on this particular project and apparently Mac Safari
> and Firefox don't fire off the Event.SELECT event.
> > Unresolved bug file:
> https://bugbase.adobe.com/index.cfm?event=bug&id=3687113
> >
> > I'm restricting file extensions, file size etc on the client side and
> that's when I'm running that validation (after file is selected and before
> upload attempt).
> >
> > Can any of you think of an alternative prior to me moving that validation
> logic to the server side after the upload attempt??
> >
> > Thanks,
> >
> > Matthew
>
> Posting a code snippet would be useful to help debug your problem
>
> Thanks,
> Om
>

Re: Mac FileReference Bug

Posted by OmPrakash Muppirala <bi...@gmail.com>.
On Jan 31, 2014 11:35 AM, "Matthew Weir" <ma...@yahoo.com> wrote:
>
> Hey all,
>
> Stuck using Flex 3.x on this particular project and apparently Mac Safari
and Firefox don't fire off the Event.SELECT event.
> Unresolved bug file:
https://bugbase.adobe.com/index.cfm?event=bug&id=3687113
>
> I'm restricting file extensions, file size etc on the client side and
that's when I'm running that validation (after file is selected and before
upload attempt).
>
> Can any of you think of an alternative prior to me moving that validation
logic to the server side after the upload attempt??
>
> Thanks,
>
> Matthew

Posting a code snippet would be useful to help debug your problem

Thanks,
Om

Re: Mac FileReference Bug

Posted by jude <fl...@gmail.com>.
Is the file reference being garbage collected before it has a chance to
load?

On Friday, January 31, 2014, Matthew Weir <ma...@yahoo.com> wrote:

> Hey all,
>
> Stuck using Flex 3.x on this particular project and apparently Mac Safari
> and Firefox don't fire off the Event.SELECT event.
> Unresolved bug file:
> https://bugbase.adobe.com/index.cfm?event=bug&id=3687113
>
> I'm restricting file extensions, file size etc on the client side and
> that's when I'm running that validation (after file is selected and before
> upload attempt).
>
> Can any of you think of an alternative prior to me moving that validation
> logic to the server side after the upload attempt??
>
> Thanks,
>
> Matthew
>