Flash Advisor logo
:: Desktop Shortcut
:: Flash Help
Advice from Experts

Closed Thread
Results 1 to 2 of 2
  1. #1

    Default Rename uploaded images

    I have a flash upload system which allows the user to upload images to an image folder on the server. I want this image folder to display their photos automatically in the gallery.


    However everyones photos are named differently. Is there anyway I can get the gallery to display the photos without knowing what each individual photo is called?

  2. # ADS
    Join Date
    Always
    Posts
    Many
     
  3. #2
    Join Date
    May 2004
    Location
    U.S.A.
    Posts
    2,890

    Default

    Hi,

    No, you will need to know the names of the image files to import them into flash at runtime. This can be achieved with a bit of PHP that returns the file names to an XML object in Flash....

    Actionscript
    Code:
    var folderData = new XML();
    folderData.ignoreWhite = true;
    folderData.onLoad = function(success) {
    	if (success) {
    		for (i in this.childNodes) {
    			trace(this.childNodes[i].childNodes[0]);
    		}
    	} else {
    		trace("failed to read dir");
    	}
    }
    The PHP code for reading directory contents...

    Code:
    <?php 
    if ($handle = opendir('.')) { 
        $s = ''; 
        while (false !== ($file = readdir($handle))) $s.= "<entry>$file</entry>"; 
        closedir($handle); 
        echo $s; 
    } 
    ?>
    hope it helps
    Regards
    NTD
    A mind once stretched by a new idea never regains its original dimensions.
    - Oliver Wendell Holmes

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Sponsors
Create Speaking Characters for your website and Flash movies. 15 Day Free Trial