Page 1 of 1

move file to new location

Posted: Fri Apr 30, 2010 3:56 am
by khhalid
Hi guys,
I want to move Excel file from one folder into another one. I am using following codes:
<?php
$file = "/uploaded/DMZ/newTest.txt";
$newlocation= "/uploaded/scanned/newTest.txt";
rename($file, $newlocation);
?>

Nothing happening when I execute the code.
Many thanks

Re: move file to new location

Posted: Fri Apr 30, 2010 4:11 am
by hypedupdawg
I reccommend that you read this page: http://www.w3schools.com/php/func_filesystem_rename.asp, as well as looking at the php filesystem reference. It looks like this would be the best option for you - as long as you are uploading by the $_POST method.

Code: Select all

$file = "/uploaded/DMZ/newTest.txt";
$newlocation= "/uploaded/scanned/newTest.txt";
move_uploaded_file($file, $newlocation);
PS: It is better for everyone concerned if you post your code inside the php tags provided - click the "PHP Code" button when writing a post. That way it can be expanded, hidden, etc.

Re: move file to new location

Posted: Tue May 04, 2010 7:42 am
by khhalid
Thx guys, it was permission issue.

Thank you for your time,