I'm trying to copy a file from one directory to another using php's copy function. It appears to copy it but it is a blank file (with no file size) but it has the right filename. I've tried using chmod to change the copied file's permissions but this hasn't seemed to help. Does anyone know what is going on?
Thanks,
Kyle
[SOLVED] Copy() creates a blank copy
Moderator: General Moderators
[SOLVED] Copy() creates a blank copy
Last edited by kaYak on Tue Nov 29, 2005 8:08 pm, edited 1 time in total.
Okay, here is some code:
Code: Select all
<?php
chmod("/1/file_111.txt", 0777);
copy("/1/file_111.txt","/2/file_111.txt");
?>- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
I cannot answer your question because I do not know what is causing it, but a comment at php.net/copy suggested an alternative
you can also try xcopy command by using Shell to move/copy files/folders from one place to another
here is the code:
by executing this command, it will move folder along with all contents to destination.Code: Select all
<?php exec('xcopy c:\\myfolder d:\\myfolder /e/i', $a, $a1); ?>