Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rmdir(); using variable from Flash

Status
Not open for further replies.

lmblank

Programmer
Jan 10, 2005
1
US
I am trying to pass a Flash variable to a PHP page via the loadVars.sendAndLoad function. The variable name corresponds to a folder name that needs to be removed via the rmdir(); function. The Flash variable is passing fine, but will not delete the folder properly. Is it a string problem, or am I missing a step?

Here is the code used:

[blue]
FLASH CODE:
//----------------FLASH-----------------//
sender_btn.onPress = function() {
var getIT_lv:LoadVars = new LoadVars();
//below defines the variable to be passed to php from inpupt text field
getIT_lv.fname = _level0.input_txt.text;
getIT_lv.onLoad = function() {
//returned statement from PHP confirming deletion of folder
_level0.fromServer_txt.text = this.fromPHP;
};
getIT_lv.sendAndLoad("del_folder.php", getIT_lv,"POST");
};
//----------------------------------------//

PHP CODE:
//------------------PHP CODE---------------//
<?php
$fnew=$HTTP_POST_VARS["fname"];
rmdir($fnew);
$msg= $fnew . " has been deleted!";
$output="fromPHP=$msg";
echo $output;
?>
[/blue]

Any help would be greatly appreciated.

Thanks,
~Law Blank
 
I haven't used flash in ages, so I'm not sure, but I think its just a PHP error.

To remove directory "logs", you would use:
Code:
rmdir("./logs");

and not
rmdir("logs"); or rmdir("/logs");

So, the flash variable must contain "./logs", unless you tell PHP to add those two characters if they don't exist.
 
remember:
rmdir can only be used on empty folders!
eg. if the folder is not empty, you need to recursivly remove everything in it.

There are sample codes of this, if you google for it.
I accidently stumbled across one very nice function, but I dont remember quite what I was googling for (was something completely different).

And now, for something completely different, coffee.

Olav Alexander Mjelde
Admin & Webmaster
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top