Problem with php's rename function


Posted on 16th Feb 2014 07:03 pm by admin

So, i'm having a problem with the php rename function. Basically my script 'delete_user.php' attempts to copy the users xml file(i stored all users information, in xml files as a backup of my database). They're all located in a folder named "xml", which is located in the root directory of my website, as is 'delete_user.php'. What i want to do is, that the file name is changed when the person's user account is deleted. Here's the code i've tried to do it with, i get an 'invalid directory / file error' when i try to run the script.

Code: <?php $path = "/xml/";
// you cannot see it here, but $login contains a username. (The username is the name of the file)
// eg. an user named "sharal" would have an associated xml file named "sharal.xml"
// this is not exactly what i want it to do, but it simply renames the file with it's original name
// and adds "old" behind it
$file = $login;
$old = "old";
$new_path = $login . $old;

rename($path.$file.".xml", $path.$new_path.".xml"); ?>

No comments posted yet

Your Answer:

Login to answer
102 Like 9 Dislike
Previous forums Next forums
Other forums

mysql select query problem
how can i select multiple fields from multiple table in one query like

i have table name t1 a

Php If in MySql query (hiding labels if a field is empty)
Okay, I've been trying to do this for a while, and I'm finally going to ask for help so I can get th

How to get exact 3 moths post date from today date using javascript
How to get exact 3 moths post date from today date using javascript
Please help

Having Problem with Date
l have a submit buttom where user have the possibility to add a date to specify when his message s

Suggestions for Functional module
Hello experts,
I Have done B.Sc(Mathematics) and MCA & have learnt SAP/ABAP but do n

form help
this doesn't work. i want the form action to go the location.href of the submit button chosen.. how

Auto fill in input value based on User_ID
Hello,

I'm looking form some input on the following problem.

User loads page ->

Preg_match question
I want to use preg_match to make sure a string is always 6 characters long and only contains 0-9 and

Impact of movement type 412 E on MAP
Hi

Usage of movement type 412 E is causing huge change in MAP .

Is there any r

Not sure why this script is not working?
Hi I am new to php programing and I was trying to make up a simple script like a captcha but I canno

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash