Reputation: 130
I have had my shared web server suspended twice now for moving large files with a self-built php CMS using copy(). The admins told me that I had used up all the read/write bandwidth on the machine and that PHP is very inefficient at moving files.
I want to be able to move these files via a web interface in my CMS. Is there a way I can do this without bogging down the server?
Upvotes: 0
Views: 412
Reputation: 4788
If you just want to move them, use rename()
Since you're doing this from a CMS, are you using user input to determine source or destination? Be sure to sanitize any inputs, one thing to look at is realpath()
Upvotes: 0
Reputation: 91912
Use rename. This will just change the place in the filesystem, not copy the entire contents of the file, and therefore is much more efficient.
Upvotes: 1