I am new to PHP and trying to move a zip file from one directory to another. I researched on the web on this and all fingers pointed to this rename() function.
I tried writing a PHP script which simply moves a zip file (located in the same directory as the source code) to another directory by:
Expand|Select|Wrap|Line Numbers
- <?php
- $sourcecode = dirname(__FILE__).'\zipfile.zip'; //appending the current directory with the file name
- $destination = 'C:\xampp\htdocs';
- rename($sourcecode, $destination);
- ?>
Warning: rename(C:\xampp\htdocs\tutorial\zipfile.zip,C:\xam pp\htdocs) [function.rename]: File exists in C:\xampp\htdocs\tutorial\movingfiles.php on line 5
Any one knows where I am screwing up? Tried to fiddle around with it without much luck.
Thanks for looking at this.