whoa, that hecka odd. I replied to your question 6 hours ago, but it did not get posted. Now i have to type it in again :-)
What is wrong in your code is the space character after the /. So your line should read:
if (!copy($the_file, $path . "/" . $the_file_name)) {
You had put the space character after the "/ part. Doing this will name the file with a space character as the first character. As far as the execute perm. Well, the server automatically puts this. As long as the user which the server runs as does not have this execute permission, its OK.
do ls -l and it should say something like:
-rwxr-xr-- 1 user group filesize filename.
to remove your file with the space character under shell do:
rm " image.jpg" (with the quotes and the first character as a space character)
in FTP do:
del " image.jpg"
that should get rid of your annoying "space'd" files!
hope this helps,
-Sridhar