1 Reply Latest reply on Jun 30, 2006 11:06 AM by Newsgroup_User

    FileReference

    babo_ya Level 3
      Anyone knows a good example of how to use this class? Both actionscript and ASP.NET verion of file upload page.
      Any resource will be helpful.

      Thanks,
        • 1. Re: FileReference
          Level 7
          The liveDocs has a great sample:
          http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context= LiveDocs_Parts&file=00002204.html
          import flash.net.FileReference;

          var allTypes:Array = new Array();
          var imageTypes:Object = new Object();
          imageTypes.description = "Images (*.jpg, *.jpeg, *.gif, *.png)";
          imageTypes.extension = "*.jpg; *.jpeg; *.gif; *.png";
          allTypes.push(imageTypes);

          var textTypes:Object = new Object();
          textTypes.description = "Text Files (*.txt, *.rtf)";
          textTypes.extension = "*.txt;*.rtf";
          allTypes.push(textTypes);

          var listener:Object = new Object();

          listener.onSelect = function(file:FileReference):Void {
          trace("onSelect: " + file.name);
          if(!file.upload(" http://www.yourdomain.com/yourUploadHandlerScript.cfm"))
          {
          trace("Upload dialog failed to open.");
          }
          }

          listener.onCancel = function(file:FileReference):Void {
          trace("onCancel");
          }

          listener.onOpen = function(file:FileReference):Void {
          trace("onOpen: " + file.name);
          }

          listener.onProgress = function(file:FileReference, bytesLoaded:Number,
          bytesTotal:Number):Void {
          trace("onProgress with bytesLoaded: " + bytesLoaded + " bytesTotal: " +
          bytesTotal);
          }

          listener.onComplete = function(file:FileReference):Void {
          trace("onComplete: " + file.name);
          }

          listener.onHTTPError = function(file:FileReference):Void {
          trace("onHTTPError: " + file.name);
          }

          listener.onIOError = function(file:FileReference):Void {
          trace("onIOError: " + file.name);
          }

          listener.onSecurityError = function(file:FileReference,
          errorString:String):Void {
          trace("onSecurityError: " + file.name + " errorString: " + errorString);
          }

          var fileRef:FileReference = new FileReference();
          fileRef.addListener(listener);
          fileRef.browse(allTypes);--

          Dan Mode
          *THE online Radio* http://www.tornadostream.com
          *Must Read* http://www.smithmediafusion.com/blog
          *Flash Helps* http://www.smithmediafusion.com/blog/?cat=11

          "babo_ya" <webforumsuser@macromedia.com> wrote in message
          news:e80rn6$nmi$1@forums.macromedia.com...
          > Anyone knows a good example of how to use this class? Both actionscript
          > and ASP.NET verion of file upload page.
          > Any resource will be helpful.
          >
          > Thanks,