The second argument to copy() function cannot be a directory

You are specifying to move a file to a directory; neither PHP's move_uploaded_file nor its copy is as smart as a shell's copy -- you have to specify a filename, not a directory, for the destination.

So, one simple solution would be to take the basename of the source file and append that to the destination directory.


It's because you're moving a file and it thinks you're trying to rename that file to the second parameter (in this case a directory).

it should be:

move_uploaded_file($_FILES['userfile']['tmp_name'], 'c:/wamp/www/uploads/images/'.$file['name']);

It sounds like the second argument to move_uploaded_file should be a full file name instead of just the directory name. Also, probably only a style issue, but you should use consistent slashes in 'c:\wamp\www\uploads\images/'

Tags:

Php