A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Post variable from Flash to php

  1. #1
    Junior Member
    Join Date
    Nov 2009
    Location
    UK
    Posts
    22

    Post variable from Flash to php

    Hi all,

    I've got a flash front end for an image gallery. The images are pulled into
    Flash via php which delivers a string of filepaths - this works fine.

    Now I need to allow users to delete certain images if they choose so I need
    to be able to pass a particular filepath to a new php file (delete.php).

    I have the filepath of the currently displayed image as a variable in flash
    called "delete_path".

    QUESTION - how, (on a button trigger with AS2) can I pass this string "delete_path" to delete.php ?

    WORTH KNOWING - there is tons of other dynamic data on the flash front end
    and I don't really want to chuck it all at the php file - just the one variable "delete_path".

    Best wishes
    monty

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    send to php (using LoadVars - AS2) -
    PHP Code:
    myLoadVars = new LoadVars();
    myLoadVars.delete_path "your.jpg";
    myLoadVars.sendAndLoad("your.php"myLoadVars"POST");
    myLoadVars.onLoad = function(){
    trace("File removed = "+this.removed);
    }; 
    in your.php (resides in same folder as images) -
    PHP Code:
    <?php
    $delFile
    =$_POST[delete_path];
    unlink($delFile);
    print 
    "&removed=".$delFile;
    ?>

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