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

Problem with creating FI documents
Hi, Experts!

when i create Fi doc. with standart transaction, i ve been had such problem

private constructor
Hello,

Can we create a constructor as private? If yes, what is the use of it? If no, why can'

All possible combinations of Strings from table in PL/SQL
Hi,

I am trying to figure out how to build a list of all possible string combinations fro

Changing color in GD via variable?
Hey guys, I'm new here. x)

I'm very much a noob when it comes to PHP, but I'm trying to learn

Problem with PHP code- simple contact form
I'm relativily new to PHP; I know HTML and CSS stuff but I have a problem- I have a contact form wit

need help with mail()
hi i want to send an email with attaching pdf file using php. i have the following script but the pr

cPanel API
Hi Guys,

Need a little guidance. I'm trying to get my script to communicate with cPanel (or W

Custom list order
Hi there,

I have checked this tutorial and it's great till the point where I want to display

multipart emiail forms
Hi All,

I am new to the boards and I've been working on a form (which is rather massive, imo

Read from a text file after a specific word
Hi all.

I have a text file that looks like the one below.
I know how to open the text fi

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