A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: Flash file upload

  1. #1
    3DFA hobby scripter LewxX²'s Avatar
    Join Date
    Jul 2006
    Location
    Germany, Karlsruhe
    Posts
    198

    Question Flash file upload

    Does someone know how to create a file upload with 3DFA,
    of if that is possible?

    I would like to know

    Or, Kusco, can you include the necessary function to the next release ?

    I found a tutorial here:
    http://www.flash-db.com/Tutorials/upload/
    http://www.flash-db.com/Tutorials/upload/upFiles.php?
    but unfortunately it isn't working in 3DFA.

    Or if someone knows how to open the file-browsing dialog box with a button, that would be great, too!

    Greets, LewxX²
    sorry for my bad school English
    btw. visit my Page: projects.lewxx.de
    or lewxx.de (<= German)

  2. #2
    A Senior Newbie - How Odd ForumNewbie's Avatar
    Join Date
    Mar 2003
    Posts
    590

    resolved

    Quote Originally Posted by LewxX²
    Or if someone knows how to open the file-browsing dialog box with a button, that would be great, too!
    To open the file browsing dialogue from a button, my understanding is that you just create the button, and on the 'button down' action, run a script that has the following code:

    PHP Code:
    // Initialise
    var ChooseFileTypes '*mp3;*exe'            // Types of files to be selected
    WhichFilesSelected = new Array                // Array in which the output will go
    // Now open the file open dialogue and capture data in array
    WhichFilesSelected Application.fileOpenMultiDialog (ChooseFileTypes)

    // Now cycle through the array, and do something with the output
    for (a=0a<=WhichFilesSelected.length a++)
        {
                 
    // Do something with each file 'WhichFileSelected[a]'
        

    Your array 'FilesSelected' should contain the names of all files selected.

    HOWEVER: This doesn't work on export. If I can get hold of the support e-mail address, I'll send it to them ! Is 4.9.8.7 just a beta test version or am I missing something fundamental?

    Cheers,

    M.

    Edit: This has been reported to support using the 'e-mail support' option from the website, since I figured an attachment was not needed.
    Last edited by ForumNewbie; 06-05-2008 at 10:06 AM.
    Please note that my domain has changed to http://www.morganmultinational.com

  3. #3
    3DFA hobby scripter LewxX²'s Avatar
    Join Date
    Jul 2006
    Location
    Germany, Karlsruhe
    Posts
    198
    cool, thx!
    sorry for my bad school English
    btw. visit my Page: projects.lewxx.de
    or lewxx.de (<= German)

  4. #4
    Senior Member kusco's Avatar
    Join Date
    Nov 2001
    Posts
    681
    The Application class is internal only, not part of Flash, and is only intended for use with standalone executables. In any case, this class is renamed to Executable in the next release to avoid a name conflict with Flex.
    Cheers,
    kusco
    (3DFA Support Team)

  5. #5
    A Senior Newbie - How Odd ForumNewbie's Avatar
    Join Date
    Mar 2003
    Posts
    590
    Thanks Kusco,

    That's a shame. Would have been nice functionality. So to do this, I guess it would have to be done with some sort of external script.

    All the same, it would be nice if 3DFA told you it wasn't compatible with Flash when compiling, rather than just crashing. Also, I found that this doesn't work in the executable after I compiled it, so I think this will need a bit of testing once the name changes have been completed.

    I'll have a think about a PHP script that might work instead.

    Morgan.
    Please note that my domain has changed to http://www.morganmultinational.com

  6. #6
    3DFA hobby scripter LewxX²'s Avatar
    Join Date
    Jul 2006
    Location
    Germany, Karlsruhe
    Posts
    198
    Kusco, could you include the flash.net.FileReference in the next release?

    to make the following script work?
    PHP Code:
    //Allow this domain
    System.security.allowDomain("http://localhost""127.0.0.1");
    import flash.net.FileReference;

    // The listener object listens for FileReference events.
    var listener:Object = new Object();

    listener.onSelect = function(selectedFile:FileReference):Void {
      
    statusArea.text += "Attempting to upload " selectedFile.name "\n";
      
    selectedFile.upload("http://localhost/upload/upload.php");
    };

    // the file is starting to upload.
    listener.onOpen = function(selectedFile:FileReference):Void {
      
    statusArea.text += "Uploading " selectedFile.name "\n";
    };
    listener.onHTTPError = function(file:FileReferencehttpError:Number):Void {
        
    imagePane.contentPath "error";
        
    imagePane.content.errorMSG.text "HTTPError number: "+httpError +"\nFile: "file.name;
    }

    listener.onIOError = function(file:FileReference):Void {
        
    imagePane.contentPath "error";
        
    imagePane.content.errorMSG.text "IOError: "file.name;
    }

    listener.onSecurityError = function(file:FileReferenceerrorString:String):Void {
        
    imagePane.contentPath "error";
        
    imagePane.content.errorMSG.text "SecurityError: "+SecurityError+"\nFile: "file.name;    
    }

    // the file has uploaded
    listener.onComplete = function(selectedFile:FileReference):Void {
      
    statusArea.text += "Upload finished.\nNow downloading " selectedFile.name " to player\n";
      
    details.text ""
      
    for(i in selectedFiledetails.text +="<b>"+i+":</b> "+selectedFile[i]+"\n"
      
    downloadImage(selectedFile.name);
    };

    var 
    imageFile:FileReference = new FileReference();
    imageFile.addListener(listener); 
    to make the follow swf possible:
    http://www.flash-db.com/Tutorials/upload/upload.swf
    sorry for my bad school English
    btw. visit my Page: projects.lewxx.de
    or lewxx.de (<= German)

  7. #7
    Senior Member Zoranan's Avatar
    Join Date
    May 2008
    Posts
    126
    wow, too bad this doesn't work on export...

  8. #8
    3DFA hobby scripter LewxX²'s Avatar
    Join Date
    Jul 2006
    Location
    Germany, Karlsruhe
    Posts
    198
    yeah
    sorry for my bad school English
    btw. visit my Page: projects.lewxx.de
    or lewxx.de (<= German)

  9. #9
    Senior Member Zoranan's Avatar
    Join Date
    May 2008
    Posts
    126
    So, will this ever be available in 3DFA?

  10. #10
    3DFA hobby scripter LewxX²'s Avatar
    Join Date
    Jul 2006
    Location
    Germany, Karlsruhe
    Posts
    198
    I hope so ^^
    sorry for my bad school English
    btw. visit my Page: projects.lewxx.de
    or lewxx.de (<= German)

  11. #11
    3DFA hobby scripter LewxX²'s Avatar
    Join Date
    Jul 2006
    Location
    Germany, Karlsruhe
    Posts
    198
    I got it to work!

    Test it & Download source here:
    http://flash.lifestylepics.de/upload/

    The only thing that doesn't works:
    browse([typelist:Array])
    I can't set the typelist,

    in Adobe flash:
    browse([{description: "Image Files", extension: "*.jpg;*.gif;*.png"}]);
    works, but in 3DFA it doesn't!
    sorry for my bad school English
    btw. visit my Page: projects.lewxx.de
    or lewxx.de (<= German)

  12. #12
    3DFA hobby scripter LewxX²'s Avatar
    Join Date
    Jul 2006
    Location
    Germany, Karlsruhe
    Posts
    198
    So I finally created a working multiple file uploader: http://flash.lifestylepics.de/multi_upload/en/
    Last edited by LewxX²; 07-29-2008 at 03:09 PM.
    sorry for my bad school English
    btw. visit my Page: projects.lewxx.de
    or lewxx.de (<= German)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center