0

As the title says, how do I copy an image which directory is this:

img/user.png

and let's say we want to copy this image to

user_files/username/putfilehere.png

I've found some really long routes to this, but I believe it can be achieved with a couple of lines of code.

Donny123
  • 105
  • 6
  • Duplicate of: http://stackoverflow.com/questions/19139434/php-move-a-file-into-a-different-folder-on-the-server – icecub Mar 16 '15 at 18:04

1 Answers1

0

Let's assume our script is located in directory /www/ and you want to copy image from /www/img/user.png to /www/user_files/username/putfilehere.png. In that case it's pretty easy to do:

copy('./img/user.png', './user_files/username/putfilehere.png');
sota
  • 365
  • 3
  • 8