If you do:
if(!@copy($the_file, "$the_path") { ...
the condition is true if the copy is unsuccesful. You have an echo message saying the file was succesfully copied when in fact it wasn't.
Try removing the '!' so that it reads:
if(@copy($the_file, "$the_path") {