How to work around Flash error 2176
In my Flex application, users should be able to upload and download content. However, this content is restricted and I need to do a permission check before allowing upload / download. The user clicks on the link and then selects the file using the FileReference class. The FileReference class does not bind cookie data, so I cannot use the session.
I want to implement a two step process where the client first pings the server to get a one-time token and then uploads or downloads using the one-time token as a parameter. However, this plan is thwarted by bug # 2176, which appears to be a security patch for FP10, which allows upload / download to be triggered during MouseEvent flashing. Is there anyway around this?
+2
a source to share
1 answer
I have a desktop for this here.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
minWidth="955" minHeight="600"
creationComplete="creationCompleteHandler(event)">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.CloseEvent;
import mx.events.FlexEvent;
protected function creationCompleteHandler(event:FlexEvent):void
{
Alert.show("Now you can save the file!", "Test", Alert.OK|Alert.CANCEL, null, closeHandler);
}
protected function closeHandler( event:CloseEvent ):void
{
var fileReference :FileReference;
if ( event.detail == Alert.OK )
{
fileReference = new FileReference();
fileReference.save("http://www.bogdanmanate.com", "test.txt");
}
}
]]>
</mx:Script>
</mx:Application>
+3
a source to share